Windows Server 1709: Enable Linux Container in Docker

One of the new feature introduced in Windows Server version 1709, about Docker, is the possibility to run Linux container like Windows Server Container. In this article I will show how to configure your environment to run Linux container on Docker based on Windows Server.

Virtual Machine Configuration

The main requirement to run Linux container on Windows is enable the Nested Virtualization, introduced in Windows Server 2016; in case you have a physical machine, this steps can be skipped. Run these PowerShell cmdlets to enable virtualization, and MAC Spoofing, inside the virtual machine:

 

  • Get-VM “VMName” | Set-VMProcessor -ExposeVirtualizationExtensions $true
  • Get-VMNetworkAdapter -VMName “VMName” | Set-VMNetworkAdapter -MacAddressSpoofing On

 

To enable NV, you must have a CPU with support to advanced virtualization (Intel VT-x). Don’t forget to set also a static memory to avoid low performance resources.

 

Docker Configuration

The v1709 has introduced the possibility to use the Enterprise Edition Preview, the business brother of Egde ring in Docker Community Edition (read more here: Docker: Enterprise Edition vs Community Edition). In this moment the preview edition is the 17.10 (year.month) and the production build is the 17.06. This build container the LinuxKit module (13MB) that allows Windows to create and run Linux images on Docker.

 

To enable this role, run these commands:

 

Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview
Restart-Computer

 

After restart, run these commands to enable Linux mode:

 

[Environment]::SetEnvironmentVariable(“LCOW_SUPPORTED”, “1”, “Machine”)
Restart-Service Docker

 

To disable Linux mode, run these commands:

 

[Environment]::SetEnvironmentVariable(“LCOW_SUPPORTED”, “$null”, “Machine”)
Restart-Service Docker

 

Now it’s time to test the solution with a new container based on Ubuntu: docker run -it ubuntu

 

 

Don’t forget that is a preview edition and some issues can be present but Microsoft and Docker are working on to resolve everything with the goal to release the RTM before the end of the year.

 

S