I never thought running Linux containers on Windows Server is a big deal. A reason that I run Docker for Windows on my Windows 10 laptop is to run some Linux based containers. I thought I just need to install Docker for Windows on a Windows Server 2016 server with Container feature enabled, then I should be able to run both Linux and Windows containers. I didn’t know it is not the case until when I tried it yesterday.
It turns out the Linux Containers on Windows (lcow) Server is a preview feature of both Windows Server, version 1709 and Docker EE. It won’t work on Windows Server 2016 of which the version is older than 1709. As a side learning of this topic, I also got some ideas about the Windows Server semi-annual channel. An interesting change.
So here is a summary of how to enable lcow on Windows Server, version 1709.
- First of all, you need to get a Windows Server, version 1709 up and running. You can get the installation media of Windows Server, version 1709 from here. As I use Azure, I provision a server based on the Windows Server, version 1709 with Container image. Version 1709 was only offered as a Server Core installation. It doesn’t have the desktop environment.
Once you have the server up and running, you will have to enable the Hyper-V and Containers feature on it, and install the Docker EE preview. It can be installed with the following PowerShell script.
As I use the Azure image, the Container feature and Docker EE has been enabled on it, and docker daemon has been configured as a Windows service. I don’t have to run the above script.
Now you can follow the instruction here to configure the lcow. Specifically, I use the following script to configure it. I also update the configuration file in
C:\ProgramData\Docker\config\daemon.jsonto enable the experimental feature of LinuxKit when docker service is started.
Once you finish all the above configuration, you have enabled the lcow on Windows Server 1709. To test it, simply run
<br /> docker run --platform linux --rm -ti busybox sh<br />
That is it. If you want, you can also try to run Ubuntu containers by following the instructions here.