In this tutorial, we will look at how you can configure your Windows server 2019 to run Docker containers. Docker has been a game changer in Applications containerization and the whole microservices design and deployment patterns. Docker makes it easy to build, ship and run images containing applications with their dependencies and avoid crazy dependency issues common with the use of Virtual Machines.

Docker engine is what powers docker containers. It was originally written for Linux but a lot of work has been done to enable Windows and macOS users to run Docker containers.

One pre-requisite is the installation of a Windows server. This can be on a Virtual Machine running on-premise, a Physical server deployment or a Cloud instance running in Azure. You can refer to our installation guide below.

How to Install Windows Server 2019 Step by Step

How to run Docker Containers on Windows Server 2019

Before you can use the Windows Containers to run multiple isolated applications your system, you’ll need to enable the containers feature and install Docker on Windows Server 2019.

Step 1: Enable the containers feature in Windows Server 2019

The first step is to enable the Windows Server 2019 containers feature. Open PowerShell as Administrator.

run docker containers windows server 2019 01

Run the following commands.

Install-Module -Name DockerMsftProvider -Repository PSGallery -Force

This will install the Docker-Microsoft PackageManagement Provider from the PowerShell Gallery. 

Sample output is as shown below:

run docker containers windows server 2019 02

Step 2: Install Docker on Windows Server 2019

once the Containers feature is enabled on Windows Server 2019, install the latest Docker Engine and Client by running the command below in your PowerShell session.

Install-Package -Name docker -ProviderName DockerMsftProvider

Agree to the installation using “Yes” or “Y” or “A” to Agree to all.

run docker containers windows server 2019 03

When the installation is complete, reboot the computer.

Restart-Computer -Force

Installed Docker version can be checked with:

Administrator> Get-Package -Name Docker -ProviderName DockerMsftProvider
Name Version Source ProviderName
---- ------- ------ ------------
docker 18.09.2 DockerDefault DockerMsftProvider

The same can be achieved with the docker --version command.

PS C:\Users\Administrator> docker version
Version: 18.09.2
API version: 1.39
Go version: go1.10.6
Git commit: 1ac774dfdd
Built: unknown-buildtime
OS/Arch: windows/amd64
Experimental: false
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.39/version: open //./pipe/docker_engine: The system cannot find the file specified. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

Upgrade can be done anytime by running the following commands on PowerShell.

Install-Package -Name Docker -ProviderName DockerMsftProvider -Update -Force
Start-Service Docker

Step 3: Run Docker Container

Start Docker Daemon

Start-Service Docker

After starting Docker Engine service, Download the pre-created .NET sample image from the Docker Hub registry:

docker pull

You can retrieve a list of all available tags for dotnet/samples at

Then deploy a simple container running a .Net Hello World application.

docker run

The container will start, print the hello world message, and then exits.

Running Linux Containers on Windows Server 2019

Out of the box, Docker on Windows only run Windows container. To use Linux containers on Windows Server, you need to use the Docker Enterprise Edition Preview which includes a full LinuxKit system for running Docker Linux containers.

Uninstall your current Docker CE.

Uninstall-Package -Name docker -ProviderName DockerMSFTProvider

Enable Nested Virtualization if you’re running Docker Containers using Linux Virtual Machine running on Hyper-V.

Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true

Then install the current preview build of Docker EE.

Install-Module DockerProvider
Install-Package Docker -ProviderName DockerProvider -RequiredVersion preview

Enable LinuxKit system for running Linux containers

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")

Restart Docker Service after the change.

Restart-Service docker

Pull a test docker image.

> docker run -it --rm ubuntu /bin/bash
[email protected]:/# cat /etc/os-release
VERSION="18.04.1 LTS (Bionic Beaver)"
PRETTY_NAME="Ubuntu 18.04.1 LTS"

[email protected]:/# exit

To Switch back to running Windows containers, run:

[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "$null", "Machine")

Enjoy running Linux and Windows containers on Windows Server 2019. Drop us a comment in case of any issues.

Best Docker Learning Courses:

Also check:

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.



Please enter your comment!
Please enter your name here