Rolf Neugebauer

Preview: Linux Containers on Windows

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, 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.

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

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 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:

, , , ,

Rolf Neugebauer

Preview: Linux Containers on Windows


7 Responses to “Preview: Linux Containers on Windows”

  1. Glen A.

    I have two questions:

    1. Will this run on Windows 10 Home in future?
    2. Will it only run on Hyper-V, or will there be support for VirtualBox as well?

    Thanks.

    Reply
  2. Michael Evans

    I'm running Windows Server 2016 build 16278

    It seems I'm hung on
    API listen on
    //./pipe//docker_lcow
    DEBU[2017-10-05T09:58:19.481545200-05:00] Config reload – waiting signal at %!s(*uint16=0xc0429fa000)

    Any thoughts

    Reply
  3. Vince

    followed the instructions.
    docker -H "npipe:////./pipe/docker_lcow" version

    shows
    Server:
    OS/Arch: windows/amd64
    Experimental: true

    even after I set the environment variable using both methods below
    $Env:LCOW_SUPPORTED=1

    [environment]::SetEnvironment("LCOW_SUPPORTED","1","Machine")

    Reply
  4. Stefan Billiet

    Same with me, followed the instructions, but version still says windows/amd and when I try to launch busybox, it complains that it can't find a windows container image for it 🙁

    Reply
  5. Craig Allen

    fails last step. downloads the image but fails to start:
    C:\Program Files\Docker\Docker\Resources\bin\docker.exe: failed to register layer: failed to start service utility VM (applydiff 6b72a9a8bbdcc3ab63096389d0946cf82080c4f95a49ae25df341b1a80581645): container 6b72a9a8bbdcc3ab63096389d0946cf82080c4f95a49ae25df341b1a80581645_svm encountered an error during CreateContainer: failure in a Windows system call: winapi error #3228369022 (0xc06d007e) extra info: {"SystemType":"container","Name":"6b72a9a8bbdcc3ab63096389d0946cf82080c4f95a49ae25df341b1a80581645_svm","Layers":null,"HvPartition":true,"HvRuntime":{"ImagePath":"C:\\Program Files\\Linux Containers","LinuxInitrdFile":"initrd.img","LinuxKernelFile":"bootx64.efi"},"ContainerType":"linux","TerminateOnLastHandleClosed":true}.
    See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run –help'.

    Reply
  6. Jon

    Same, fails to run, daemon starts up fine but docker run command complains about no matching manifest for windows/amd64

    Reply
  7. Oliver 'kfsone' Smith

    What bizarre dimension have we entered where the best way to run all the software … is to run Windows?

    Mr Allen makes a fine point about Windows admins being able to locally host Linux apps.

    This speaks a lot to Microsoft reviving its roots as a software developer, that happened to make an operating system.

    What I'd really love to see is the ability to have a docker container AD/DNS/DHCP server that I can deploy to a Linux, Cloud or Windows host without needing a VM.

    Reply

Leave a Reply

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.