📜 ⬆️ ⬇️

Linux containers for Windows

Soon there will be a new big update for the Windows Server operating system, in early September a small post about it on the TechNet blog, and some of its new features will delight Docker users. One of the main news is that
Thanks to Hyper-V technology, Docker can now run Linux containers in Windows, similar to Hyper-V Windows containers.



LinuxKit: what is it?


Running Linux containers with Docker requires a minimal Linux kernel and user space for container processes. The LinuxKit toolkit was specifically designed by Docker to create robust, compact and portable Linux subsystems in which Linux containers are part of the platform.

Below is a preliminary version of LinuxKit for Linux Docker containers running on Windows. Work on the prototype continues, and to launch it requires one of the recently introduced assemblies of Windows Server Insider or Windows 10 Insider.
')

Running Linux Containers on Windows


The instructions below have been tested on builds 16278 and 16281 of Windows 10 and Windows Server Insider, respectively.

Before you begin, make sure you have Docker for Windows (if you are using Windows 10) or Docker Enterprise Edition (if you are using Windows Server Insider).

Configuring Docker and LinuxKit


To access the pre-build of LinuxKit, you can run 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 download the Docker daemon build from the main development branch with the preliminary version of Linux container support for Windows:

 Invoke-WebRequest -UseBasicParsing -OutFile dockerd.exe https://master.dockerproject.org/windows/x86_64/dockerd.exe 

Start the new Docker daemon from the default installation, which is waiting for data to be transferred through a separate channel and uses a separate storage:

 $Env:LCOW_SUPPORTED=1 .\dockerd.exe -D --experimental -H "npipe:////./pipe//docker_lcow" --data-root c:\lcow 

We are testing


Run the linux container:

 docker -H "npipe:////./pipe//docker_lcow" run -ti busybox sh 

Docker just launched a minimal virtual machine using a LinuxKit instance that hosts the Linux container.

Since this is one of the first preliminary versions, its capabilities are limited, but it supports basic Docker commands, such as pull and run .

What's next?


Development of Windows Server Insider assemblies and support for Linux Docker containers in Windows is at an early stage. Windows developers and server administrators will find it easier to work with Linux Docker containers on Windows in the new release of Windows Server. Developers will be able to run Docker containers for Windows and Linux on the same system, making it easier to build and test heterogeneous applications consisting of Docker containers for both platforms.

Administrators who prefer Windows will soon be able to easily run software designed specifically for Linux (for example, HAProxy and Redis) using Docker Linux containers on Windows. In particular, these containers will make it easier to configure Docker Enterprise Edition and the Universal Control Plane application (which uses components designed specifically for Linux) in the Windows Server operating system.

I hope that this guide will help you start your own experiments with LinuxKit.

Source: https://habr.com/ru/post/339214/


All Articles