Microsoft is getting ready for the next big update for Windows Server (check out today’s complimentary Microsoft blog post) and some of the new features are very exciting for Docker users. One of the most important enhancements is that Docker can now run Linux containers on Windows (LCOW), using Hyper-V technology.
Running Docker Linux containers on Windows requires a minimal Linux kernel and userland to host the container processes. This is exactly what the LinuxKit toolkit was designed for: creating secure, lean and portable Linux subsystems that can provide Linux container functionality as a component of a container platform.
We’ve been busy prototyping LinuxKit support for Docker Linux containers on Windows and have a working preview for you to try. This is still a work in progress, and requires either the recently announced “Windows Server Insider” or Windows 10 Insider builds.
UPDATE: LCOW support is available in Windows 10 Fall Creators Update and in Windows Server 1709. The simplest way to try it out on Windows 10 is to install the edge variant of Docker for Windows (details). On Windows Server 1709, install EE preview.
Running Docker Linux Containers on Windows with LinuxKit
UPDATE: The LinuxKit LCOW repo has a README with updated details for users interested in LinuxKit.
The instructions below have been tested on Windows 10 and Windows Server Insider builds 16278 and 16281.
Be sure to install Docker for Windows (Windows 10) or Docker Enterprise Edition (Windows Server Insider) before starting.
Setup Docker and LinuxKit
A preview build of LinuxKit is available by simply running the following commands in PowerShell (with Administrator rights):
$progressPreference = 'silentlyContinue' mkdir "$Env:ProgramFiles\Linux Containers” Invoke-WebRequest -UseBasicParsing -OutFile linuxkit.zip https://github.com/friism/linuxkit/releases/download/preview-1/linuxkit.zip Expand-Archive linuxkit.zip -DestinationPath "$Env:ProgramFiles\Linux Containers\." rm linuxkit.zip
Now get a master branch build of the Docker daemon that contains preview support for Linux containers on Windows:
Invoke-WebRequest -UseBasicParsing -OutFile dockerd.exe https://master.dockerproject.org/windows/x86_64/dockerd.exe
Start a new Docker daemon listening on a separate pipe and using a separate storage location from the default install:
$Env:LCOW_SUPPORTED=1 $env:LCOW_API_PLATFORM_IF_OMITTED="linux" .\dockerd.exe -D --experimental -H "npipe:////./pipe//docker_lcow" --data-root c:\lcow
Run a Linux container:
docker -H "npipe:////./pipe//docker_lcow" run -ti busybox sh
Docker just launched a minimal VM running a LinuxKit instance hosting the Linux container!
Since this is an early preview there are some limitations, but basic Docker operations like pull and run work.
Both Windows Server Insider builds and Docker support for Linux containers on Windows are in early preview mode. When GA, Docker Linux containers on Windows will improve the Docker Linux container experience for both Windows developers and server administrators. Developers will be able to more easily build and test mixed Windows/Linux Docker applications by running containers for both platforms side-by-side on the same system.
And IT-admins that prefer Windows will soon be able to easily run (mostly) Linux-only software like HAProxy and Redis on Windows systems by way of Docker Linux containers on Windows. For example, Docker Linux containers on Windows will make setting up Docker Enterprise Edition and Universal Control Plane (which relies on some Linux-only components) on Windows Server much simpler.
We hope this LinuxKit-based walkthrough will set you up to start experimenting. Feedback is always welcome! For general help and getting started with Insider builds use the Windows Feedback Hub (Windows 10), or the Windows Server Insiders Tech Community. For issues with LinuxKit and Docker support for Linux containers on Windows use the Docker for Windows issue tracker on GitHub. And let us know on Twitter if you build something cool!
0 thoughts on "Preview: Linux Containers on Windows"