Getting started with containers and Docker on Windows Server 2016 Technical Preview 5

Feel free to contact me on Twitter @jcorioland if you have any question about this article

The Technical Preview 5 of Windows Server 2016 has been released yesterday, and it comes with a lot of new cool things for Windows containers and Docker !

To get started with this new preview, you have two solutions:

  • Download it from this page and run it where you want.
  • Deploy a new VM in Azure from the MarketPlace

I have chosen the second option, as it is simple and fast. Just search for Windows Server 2016 in the Azure MarketPlace and you’re done:


Once you are connected on your machine, you need to configure it to be a container host. It can be done with a few steps:

Install-WindowsFeature Containers

Once installed, you need to restart the machine using:

New-Item -Type Directory -Path 'C:\Program Files\docker\'

Invoke-WebRequest -OutFile $env:ProgramFiles\docker\dockerd.exe

Invoke-WebRequest -OutFile $env:ProgramFiles\docker\docker.exe

[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\Program Files\Docker", [EnvironmentVariableTarget]::Machine)

The commands above create a new Docker folder in Program Files and download the docker deamon and client binaires in this directory. The last one adds the directory in the Path environment variable.

The Docker deamon now supports an option to register it as a service on the machine:

dockerd --register-service

To start the docker service use:

Start-Service docker

Now, you need to download the base image for Docker containers on Windows. You can do it with the following commands:

Install-PackageProvider ContainerImage -Force

Install-ContainerImage -Name WindowsServerCore

Restart the Docker service:

Restart-Service docker

And your done!

docker info


You can also get the list of available images on your system by typing:

docker images


As you can see, an image named windowsservercore is available, but it does not have the “latest” tag. To tag it, type:

docker tag windowsservercore:10.0.14300.1000 windowsservercore:latest


You can run your first container with the following command:

docker run -it windowsservercore cmd

It will run a new container in interactive mode and execute cmd inside the container:


Type “exit” to leave the container.

As announced by Docker, it is now possible to write Dockerfile for Windows-based images and you can start to push/pull Windows images to and from the Docker Hub. Some example of Windows-based Dockerfile are available on GitHub:

For example, you can use this Dockerfile to create an image that will allow to run IIS in a container:

# This dockerfile utilizes components licensed by their respective owners/authors.
FROM windowsservercore
LABEL Description="IIS" Vendor=Microsoft" Version="10"
RUN powershell -Command Add-WindowsFeature Web-Server
CMD [ "ping localhost -t" ]

Save this Dockerfile in an empty directory. Open a PowerShell window in this directory and build the container image with the docker build command:

docker build -t yourimagename .


Once the image is built, login to your Docker Hub account using the docker login command:


And push the image using the docker push command:


Same experience than Docker with Linux containers ! It’s awesome !

Here are some resources that you may be interested in to go deeper in Windows Containers:

Comments (14)

  1. James Welle says:

    After running Install-ContainerHost.ps1 successfully, the result of “docker images” from the command line will be an empty listing of images – there will be no “windowsservercore” image on the local machine. This appears to be a problem with the PowerShell script. Can you confirm Julian?

    1. Hi James, did you restart your machine after running the installation script? I had to before seeing the windowsservercore image when running the docker images command. HTH.

      1. James Welle says:

        I missed that in the steps above – I do see the image in the listing after rebooting. Thanks Julien!

        1. You’re welcome 🙂

    2. says:

      Restarting the dockers service should be enough to have any newly installed images appear.

  2. Richard Moulton says:

    wget is not recognized as an internal or external command…

    Why not just ask me to run Powershell.exe and then Invoke-Webrequest?

    1. wget should work in a Powershell CLI. You can just download the file from a web browser if you want…

  3. Stephan Mattausch says:

    Each TP5 excevution of Install-ContainerHost.ps1 for me always ends up with
    Creating a first boot layer…
    Error checking context: ‘can’t stat ‘\\?\C:\Windows\System32\LogFiles\WMI\RtBackup”.
    Script complete!
    no matter what environment is used – even at Azure !
    I can run a container from local windowsservercore image but I cannot pull any images.
    Pulling an images throws an error with layers registration.
    Does anyone have an idea, what could be the cause?
    Never had such a problem with TP4.
    Thanks in advance

  4. Rajiv says:

    Where I can find more information about the storage driver “windowsfilter” used by the container. Is it a new file system introduced in windows server 2016? can this be used outside of container?

  5. Charlie says:

    Script is failing at Installing ContainerImage provider.

    Warning: package ‘ContainerImage’ failed to download. This is right after successful connection to the Docker Daemon

  6. Stephen Tunney says:

    I’m attempting to run server 2016 TP5 with docker containers. I’m running into two issues as of today, after a windows update was forced on the OS. I can’t start an instance anymore, I’m getting “The paremter is incorrect” when I run “docker run -it windowsservercore CMD”.

    Also, before the windows update I could not install a basic MSI into a container. I made sure that it does not use the MsiEmbeddedChainer table since there is a known issue with that in 2008/2012 R2 core editions as well. Still can’t run MSIs silently.

    1. Stephen Tunney says:

      Just got through my hurdle. Can’t start a container in interactive mode FROM powershell. Have to start it from standard command prompt. Ouch.

  7. Vivek Jain says:

    I am trying to install chocolatey through docker file with following command and many other slightly changed version of the same command also
    RUN powershell -Command wget -Uri -OutFile choco.ps1 -UseBasicParsing

    always get error

    PS C:\iisdemo> docker build -t iis2 .
    Sending build context to Docker daemon 9.958 MB
    Step 1 : FROM windowsservercore
    —> 5bc36a335344
    Step 2 : RUN powershell -Command sleep 1; wget -Uri -OutFile choco.ps1 -UseBasicParsin
    —> Running in f926dbc14632
    At line:1 char:10 name could not be resolved: ‘’
    + sleep 1; wget -Uri -OutFile choco.p …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
    pWebRequest) [Invoke-WebRequest], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe

    The command ‘cmd /S /C powershell -Command sleep 1; wget -Uri -OutFile choco.ps1 -UseB
    asicParsing’ returned a non-zero code: 1
    PS C:\iisdemo>

    PS C:\iisdemo> docker info
    Containers: 37
    Running: 0
    Paused: 0
    Stopped: 37
    Images: 14
    Server Version: 1.12.0-dev
    Storage Driver: windowsfilter
    Logging Driver: json-file
    Volume: local
    Network: null nat
    Kernel Version: 10.0 14300 (14300.1030.amd64fre.rs1_release_svc.160603-1734)
    Operating System: Windows Server 2016 Datacenter Technical Preview 5
    OSType: windows
    Architecture: x86_64
    CPUs: 1
    Total Memory: 3.5 GiB
    Name: Server2016
    Docker Root Dir: C:\ProgramData\docker
    Debug Mode (client): false
    Debug Mode (server): false
    Insecure Registries:

  8. David says:

    What service is using port 80 on Windows Server 2016 Core with Containers Technical Preview 5??? I have tried all solutions on the internet but none of them worked…

Skip to main content