Now that Windows Server 1709 has been released we have some new features to play with. One of the new features is native Linux Containers on Windows. In this article, I am going to walk through how to setup a Container host using Windows Server 2016 version 1709 to run both Windows and Linux Containers. I will also walk through the process of getting a Linux Container up and running with Docker.
Create a Container host Virtual Machine
For this blog post, I am going to use a Virtual Machine running Windows Server 1709. You can create a Container host on a physical Server running Windows Server 2016 1709. If you are this section can be missed.
First, we need to enable nested Virtualisation for the Virtual machine we are going to use as a Container Host. This is done via PowerShell.
In an elevated PowerShell window type
|Get-VM "1709" | Set-VMProcessor -ExposeVirtualizationExtensions $true|
Changing “1709” to your Virtual Machines name.
Install Docker Enterprise Edition on Windows Server 2016 1709
If you are following through using a physical server this is where you start.
At the time of writing this guide, this feature of Docker is still in technical preview. It should be GA in December 2017. Due to this, we are going to install the preview version of Docker Enterprise Edition.
Log on to your Container Host and type the following.
|Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview|
Press Y at the prompts.
Then reboot your machine for the changes to take effect.
Enable Docker Linux Containers
Now that we have installed Docker Enterprise Edition we now need to enable it. This is done in the same PowerShell windows as the last step. Use the following code to Enable Docker Enterprise Edition:
|[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")|
To disable Docker Enterprise Edition:
|[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", $null, "Machine")|
Lets run Some Linux Containers
Now we have installed Docker Enterprise Edition and Enabled it all we have left is to run some containers.
In the existing PowerShell window type the following to run a “Hello World” Linux Container.
|Docker run hello-world|
This will pull down the container image called Hello-World from the Docker Hub and run it
There are many Containers you can pull from the Docker Hub. Like this one for example.
|docker run -it --rm --name nyancat 06kellyjac/nyancat|
It’s ctrl-C to exit.
I am really excited about having Linux containers running on Server 2016 1709 and can’t wait till the Docker Enterprise Edition is GA. Oh and don’t forget Docker Enterprise Edition is free with Windows Server 2016.
Feel free to drop a comment with your experience with Linux containers on Windows and maybe share some cool containers with me.