How to run Docker Linux Container on Windows Server 1709
As mentioned Microsoft released the final version of Windows Server 1709 in the last week. Windows Server 1709 brings a couple of new improvements, especially in the container space. Microsoft and Docker are working on bringing Linux Container support to Windows Server, so you can now run Windows and Linux Container at the same time on a Windows Server Container Host running Windows Server 1709 or Windows 10 with the Fall Creators Update (1709).
In this post I want to show you how you setup up a Container Host to run Windows and Linux Containers at the same time using Docker.
Create Container Host Virtual Machine
If you run Docker on a physical server you can skip this step. If you want to run Docker Containers using Linux inside a Virtual Machine running on Hyper-V you should enable Nested Virtualization for the Container Host Virtual Machine. You can do this by running the following command:
Get-VM *WinContainerHost* | Set-VMProcessor -ExposeVirtualizationExtensions $true
if you want to do this on a Hyper-V Server in Azure, check out this post: How to setup Nested Virtualization in Microsoft Azure
Install Docker Enterprise Edition Preview on Windows Server 1709
First you have to install Docker Enterprise Edition Preview on your Windows Server 1709 container host. You can install the Docker EE preview using PowerShell package management, using the following commands:
Install-Module DockerProvider Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
As mentioned this is a preview version of Docker EE which enables a bunch of new features, to run Docker in production environments please use Docker EE 17.06.
Enable Docker Linux Containers on Windows
The preview Docker EE package includes a full LinuxKit system (13MB) for use when running Docker Linux containers. To enable this use the following command:
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine") Restart-Service Docker
to disable it again use the following:
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", $null, "Machine") Restart-Service Docker
Run Docker Linux Container on Windows Server
Now you are able to run Linux Containers on Windows Server 1709.
docker run ubuntu
for fun you can also run Nyancat!
docker run -it supertest2014/nyan
Things are still in preview, so don’t expect to work 100% 🙂