With the release of Windows Server 2016, Microsoft has expanded its integration with Docker to include running Docker Windows Containers. As I mentioned in my previous article, this now means that there we can now run both Docker FOR Windows and Docker ON Windows.
There are several prerequisites for installing Docker for Windows. Fortunately, Microsoft Azure already has a Windows Server 2016 with a containers template that will satisfy those requirements for you. We will go through an exercise to demonstrate what a general implementation of Docker for Windows would look like if you elected to use Azure for your computing needs.
We will start by logging into the Azure Portal and searching for the compute resource “Windows Server 2016 – with containers”.
Figure 1 Search for "Windows server with containers" in Azure
We then establish this Windows Server instance and connect to it via RDP.
Figure 2 select your new virtual machine and connect to download the RDP object
At this point, we can pull down our first Docker Windows Container by executing - "docker run microsoft/dotnet-samples:dotnetapp-nanoserver". Then use PowerShell to pull and run this demonstration container. Be aware that Docker Windows Containers are much larger than the typical Linux container.
Figure 3 ------------------ be patient!
When this image is downloaded, extracted, and is run, you will see a sample result of a .NET application. The Dotnet-bot!.
Figure 4 – result of .Net sample
In line with the default container behavior, the container terminates when it has accomplished what it needs to do. Whenever the process that the container was launched with terminates, the container instance will also terminate. However, the underlying image still exists in the image cache.
To see the container image, we can run “docker images” at the PowerShell prompt to see all the images that are locally stored on your instance and take note of the size!
Figure 4 the image you just pulled 1GB !
If we were to run this again, it would be much faster as the image already exists in the local image cache and does not need to be puilled from the remote image repository.
Now you have just run a basic Docker Windows Container on Windows 2016 in Azure! Stay tuned for more articles on Docker Windows Containers in the near future.