Docker – Windows Containers 101 – Using Windows 2016 Technical Preview 4



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…

2016-01-07 10_15_36-Foto's

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.

2016-01-07 10_19_19-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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.

2016-01-07 10_44_12-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

So now let’s check if we can find the image, and use it to create a new container…

2016-01-07 10_47_05-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

And let’s start the new container ;

2016-01-07 10_46_41-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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.

2016-01-07 10_50_38-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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.

2016-01-07 10_53_33-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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”

2016-01-07 10_22_15-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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?

2016-01-07 10_24_25-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

Command used ;

Get-Container | Select-Object name,id,state,uptime,parentimagename

Now for ease of mind, let’s delete the old container…

2016-01-07 10_29_26-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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. 🙂

2016-01-07 10_35_44-docker02 - kvaesdocker.cloudapp.net_65091 - Remote Desktop Connection

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. 😀

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.