By default, Windows Server has a docker engine that supports the launch of only windows containers. We therefore had to look for a solution to put and run the Linux containers in the docker..

And the Docker Enterprise Edition, which allows you to do it out of the box, is asking for money. I don’t know how much – I don’t know, but once on the ‘Leave a Request’ website and not just a price with three or four options, it won’t be cheap 🙂

On stackoverflow there is an instruction with a huge crutch, from 2016 it seems that the essence of the instruction is that you put it on a regular Windows 10 Docker Desktop, and then do the shenanigans and replace the necessary files on the server.

But this is too clumsy, not our way :).

That’s why we found a more elegant solution, a hole is not a hole, I am not strong in licensing issues and the “you pay for it and we will support poor Negroes, let them fuck off” policy, which allows you to run Linux containers on the server.

It consists of installing a provisional version. We use PowerShell on behalf of the administrator:

# Delete current Docker Engine
Uninstall-Package -Name docker -ProviderName DockerMSFTProvider

# Install Docker Preview
# Предложит перезагрузиться - соглашаемся
Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview

# Set Linux containers
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

# Docker restart
Restart-Service docker

We check that the linux containers are being launched:

# Run ubuntu
docker run -it --rm ubuntu /bin/bash

To switch back to Windows containers

# Set Windows containers
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "$null", "Machine")

P.S. It may be necessary to have Hyper-V and Containers Windows features enabled:

# To enable Hyper-V and Containers features using PowerShell, 
# run the following commands as Administrator.
# After running the commands, reboot your system.

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName Containers -All

UPDATE: It turned out that there is no Docker Compose in the box. How to put it in, we’ll sort it out here.: https://hackworlds.com/ustanovka-docker-compose-na-windows-server/

No Comments
Comments to: Installing and running Linux containers in Docker on Windows Server 2016 & 2019.

Your email address will not be published. Required fields are marked *

Attach images - Only PNG, JPG, JPEG and GIF are supported.

Good Reads

Worlwide

Trending

Advertiser

Login

Welcome to Typer

Brief and amiable onboarding is the first thing a new user sees in the theme.
Join Typer
Registration is closed.