Over a million developers have joined DZone.

A Preview of Linux Containers on Windows

DZone's Guide to

A Preview of Linux Containers on Windows

Jump into an early preview build of a LinuxKit toolkit prototype designed to improve Docker container use on Windows 10 and Windows Server.

· Cloud Zone ·
Free Resource

Learn how to migrate and modernize stateless applications and run them in a Kubernetes cluster.

Microsoft is getting ready for the next big update for Windows Server (check out this recent complementary 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, 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.

Running Docker Linux Containers on Windows With 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.

Set Up 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 use a separate storage location from the default install:

.\dockerd.exe -D --experimental -H "npipe:////./pipe//docker_lcow" --data-root c:\lcow

Try It

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.

Looking Ahead

Both Windows Server Insider builds and Docker support for Linux containers on Windows are in early preview mode. When in 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!

More Resources

Join us in exploring application and infrastructure changes required for running scalable, observable, and portable apps on Kubernetes.

cloud ,docker containers ,windows 10 ,windows server ,tutorial

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}