Microsoft and Docker earlier launched Docker Enterprise Edition (EE), a Containers-as-a-Service platform, for Windows Server. Windows 10 and Windows Server version 1709 contain several enhancements for Docker customers. It means that you can run Windows and Linux Containers at the same time on a Windows Server Container Host running Windows Server 1709 or Windows 10 and above with the Fall Creators Update (1709).

Running Docker Linux containers on Windows requires a minimal Linux kernel to host the containers. So there is actually one known limitation. When running an LCOW-enabled docker on Windows Server 1709, Linux containers can be started but Windows Containers won’t start.

Protect Your Data with BDRSuite

Cost-Effective Backup Solution for VMs, Servers, Endpoints, Cloud VMs & SaaS applications. Supports On-Premise, Remote, Hybrid and Cloud Backup, including Disaster Recovery, Ransomware Defense & more!

In this guide, I will describe how to run Linux Containers on Windows Server using LinuxKit.

Learn how to Run Linux on Windows with WSL here

Note that I will use Azure Virtual Machines to test Linux Containers. If you want to use Azure, you must create the Container Host using a Dv3 or Ev3 VM size.

Download Banner

Configuring the Environment

First, we need to enable nested virtualization for the virtual machine we are going to use as a Container Host. This can be done through PowerShell. In an elevated PowerShell console, type the following command:

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

You must now install Hyper-V because Hyper-V will be required even with the new LinuxKit-based approach. Use the following PowerShell command:

> Install-WindowsFeature Hyper-V -IncludeManagementTools -Restart

LinuxKit based approach

Let’s check if Hyper-V is installed by using the following command:

>Get-WindowsFeature Hyper-V |ft InstallState, PostConfigurationNeeded

Hyper-V is installed

As recommended by Docker, to try Linux Containers on Windows Server versions 1709 and above, install the preview Docker package and enable the feature. The preview Docker EE package includes a full LinuxKit system for use when running Docker Linux containers.

Docker Enterprise Edition for Windows Server 2016 (Docker EE) enables native Docker containers on Windows Server 2016. The Docker EE installation package includes everything you need to run Docker on Windows Server 2016 and above versions. In a PowerShell console, type the following commands:

> Install-Module DockerProvider

Linux Containers on Windows Server

After installing the module and the package, check if the Windows Service is running using the following command:

> get-service *docker*

Windows Service is running

Let’s check the Docker version using the following command:

> docker.exe version

Docker version

> Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview

To update the Preview Edition, I will use the Install command in order to reinstall the Preview version with the latest build. Use the –Force parameter if needed:

windows-server

Let’s check the new version. You will notice that the version number has changed. The version number 17.10 means October 2017: “Year”, “Month”.

version number has changed

Now, you can enable the Linux mode with the following commands:

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

Linux mode

Deploying Linux Containers

Now we can test the Linux containers with a new container based on Ubuntu. Here, I just want to run a very simple Hello-World Linux Container:

> Docker run hello-world

new container based on Ubuntu

This command will pull down the container image called Hello-World from the Docker Hub and run it. Below, I ran just for fun the well-known Linux Container based on Nyan Cat that you can pull from the Docker Hub.

# docker run -it –rm –name nyancat 06kellyjac/nyancat

Linux Container based on Nyan Cat

To be serious, I can create a simple Ubuntu Container using the following command:

> docker run ubuntu

Ubuntu Container

I will check the version of Ubuntu to confirm that I am running a Linux Container:

> docker run -it ubuntu

version of Ubuntu

Done! Now you can work with Linux Containers on a Windows Server host.

To finish, I just want to show you that if you want to run Windows Containers on the same host, it will fail. So, if you want to run Windows Containers side by side with Linux Containers on the same Container host, you must disable LCOW using the following command:

> docker pull microsoft/nanoserver

Windows Containers

After disabling the LCOW, the nano server image has been successfully downloaded:

nano server image

Useful links

Below are some useful links to keep informed about Docker:

Conclusion

In this article, I have described how to configure your environment in order to use Linux Containers. As we saw, Windows Server 1709 can run Linux Containers, which can be very useful for your lab and test environments.

The main known limitation is that you can’t run Linux and Windows Containers at the same time on the same Container Host. You must disable the Linux mode to run Windows Containers.

Note: Stay informed and keep updating your Docker version.

Experience modern data protection with the latest version of the BDRSuite Free edition. Try the 30 days free trial here: https://www.bdrsuite.com/vembu-bdr-suite-download/

Related Posts:

Beginners Guide for Microsoft Hyper-V: Top 8 Basic Docker Commands You Should Know – Part 36
Beginners’ Guide for Microsoft Hyper-V: How To Install Docker Container on Windows Server – Part 27
Beginners’ Guide for Microsoft Hyper-V: How to run IIS in Docker Container – Part 38
Beginners’ Guide for Microsoft Hyper-V: Windows Docker Container Networking in Hyper-V – Part 37

Follow our Twitter and Facebook feeds for new releases, updates, insightful posts and more.

Rate this post