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
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

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.

Powershell
Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

Press Y at the prompts.

Then reboot your machine for the changes to take effect.

Restart-Computer
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

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")
Restart-Service Docker
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

To disable Docker Enterprise Edition:

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", $null, "Machine")
Restart-Service Docker
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

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
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

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
view raw LinuxContainers.ps1 hosted with ❤ by GitHub

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.


Pixel Robots.

I’m Richard Hooper aka Pixel Robots. I started this blog in 2016 for a couple reasons. The first reason was basically just a place for me to store my step by step guides, troubleshooting guides and just plain ideas about being a sysadmin. The second reason was to share what I have learned and found out with other people like me. Hopefully, you can find something useful on the site.

2 Comments

How to Install Docker on Windows 10 and More! - Pixel Robots. · January 17, 2018 at 11:14 am

[…] Recently I have been learning a lot about Docker from the amazing Nigel Poulton and his courses on Pluralsight. So to help me remember what I am learning and to hopefully help someone else out I thought I would create some blog posts about Docker. I already have one about Linux containers on Windows Server 2016 1709 which you can read here. […]

Running Kubernetes Cluster in Docker for Windows on Windows 10 - Pixel Robots. · February 18, 2018 at 10:07 pm

[…] First, before you can do anything you need to make sure our computer is ready to run Docker. If your Windows 10 machine is a VM you need to enable nested virtualisation. You can follow the instructions to do this by reading the section Creating a Container Host Virtual Machine in this guide. […]

Leave a Reply

Your email address will not be published. Required fields are marked *

This website stores some user agent data. These data are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to opt-out of any future tracking, a cookie will be set up in your browser to remember this choice for one year. I Agree, Deny
674