Introduction
With this post, I’m assuming you are already familiar with the basics of Docker & Windows 2016. If not, check out Thomas Maurer’s introduction post to Windows Containers.
Deploying a Test Host
A quick way to start testing is to use search for “Container” in the images repository on Azure. You’ll notice a “Windows Server 2016 Core with Containers” image in there…
After that, you can connect to it via RemoteDesktop and have access to your trustworthy console.
First things first… (Interactive)
We’ll startup powershell… Check out which images & networks are available (by default). And then fire up a container, on which we’ll install IIS.
This is an approach that is called “Interactive”-mode. You’ll do all the steps yourself and afterwards save the image for further usage. Later in this post, I’ll describe the “Dockerfile” approach, where you create a recipe/manifest, which will be a kind of batch script of all your actions. For this part, we’ll now stop the container & save the container as a new container image.
So now let’s check if we can find the image, and use it to create a new container…
And let’s start the new container ;
There you go, a container with IIS in it… Build by hand.
And now let’s try it the Dockerfile way!
We just created an image “by hand” (interactive). The “proper” way is to use a Docker file… That is a recipe / manifest that contains all actions to build your image.
So we’ve created a Dockerfile. We’ve said we’ll be using the “windowsservercore” as the base image and are going to install IIS upon it.
Next up is to build the image… and check its existence. Now we can deploy another container using that image.
Commands used ;
New-Item c:\kvaespoc\Dockerfile -force
Notepad c:\kvaespoc\Dockerfile
Docker build -t kvaespoc c:\kvaespoc\
Docker images
Common Issue : “More than one container exists with the parameters provided”
So we’ve got two containers with the same name… This was kinda odd to me, as I’m already accustomed to docker, where the linux flavour shows the “id” by default. So let’s find out the ids, shall we?
Command used ;
Get-Container | Select-Object name,id,state,uptime,parentimagename
Now for ease of mind, let’s delete the old container…
Command used ;
Get-Container -Id 2ac7c84f-15fa-43be-921e-3f9c6c5d08a3 | Remove-Container
Common Issue : The input ContainerName does not exist, or the corresponding container is not running.
Stupid me… Trying to access a container that was not running. 🙂
Command used ;
Start-Container -Name kvaestest
Today I learned…?
- There are two ways to build images.
- Windows & Linux implementations differ slightly, though the basics are the same.
- Common errors shouldn’t stop me from trying. 😀