JumpStart # 52 – Getting started with Docker on Azure Windows Server 2016 Datacenter–With Containers Virtual Machine

In this jumpstart, we are going to see how to create a Docker enabled development environment using Windows Virtual Machine running in Azure. Typically when we create a Windows 10 VM and try to install Docker on it, it will fail with error Unable to write to the database. Exit code: 1. Docker staff confirmed that Docker for Windows is not expected to work in Azure VM or any other VM’s guest environment, unless the host/guest combo supports nested virtualization (Source).

IMPORTANT:

  1. Only Windows based Docker images can be pulled and run on Windows Server 2016 Datacenter – With Containers VM (typically on Windows Host). As of January 2017, Windows Server 2016 got no support to Linux based Docker images and If we try to get the Linux based images, we will get failed to register layer error message. This tutorial uses Windows Nanoserver based image for demo.
  2. We cannot use Docker For Windows installation on Windows Server 2016, as of now it only supports Windows 10 and also running that on Azure is not possible because of no support for nested virtualization.
  3. Switching between Windows and Linux Docker containers is only possible from Windows 10 OS Anniversary Update (which has built in support for Windows Containers and Linux containers support can be achieved by installing Docker for Windows).

Login to Azure Portal. Select Virtual Machines tab and click Add. Filter results by Windows Server 2016 Datacenter.

image

Select Windows Server 2016 Datacenter – with Containers. Click Create.

image

Fill in the required details like Name and Password.

image

For Size, I have selected DS1_V2 Standard 1 Core 3.5GB RAM. I left out all the other default settings and created the virtual machine.

Remote desktop in to the VM and check the Docker version.

image

By default, we will get following images.

image

Now lets pull a Windows compatible Docker image docker pull microsoft/dotnet-samples:dotnetapp-nanoserver.

image

Now run the image using docker run microsoft/dotnet-samples:dotnetapp-nanoserver.

image

This way we can build Windows based images and containers on Azure Windows Server 2016 Datacenter VM and can push to Docker Hub.

That’s it for now. Happy Coding and Stay Tuned!!!

You may also like...