In this tutorial, we will look at how you can configure your Windows server 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.
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.
Step 1: Enable the containers feature
The first step is to enable the Windows Server containers feature. Open “Windows PowerShell” –> “Run as Administrator“

Run the following commands to install DockerMsftProvider:
Enable-WindowsOptionalFeature -Online -FeatureName Containers
Accept by pressing the y key in your keyboard. You must restart compute, or do it manually:
Restart-Computer -Force
Step 2: Install Docker Engine
Once the Containers feature is enabled on Windows Server, install the latest Docker Engine and Client by running the command below in your PowerShell session.
Install Docker:
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider
When the installation is complete, reboot the computer.
Restart-Computer -Force
Installed Docker version can be checked with the commands below:
PS C:\Windows\system32> docker version
Client:
Version: 27.0.3
API version: 1.46
Go version: go1.21.11
Git commit: 7d4bcd8
Built: Sat Jun 29 00:03:32 2024
OS/Arch: windows/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 27.0.3
API version: 1.46 (minimum version 1.24)
Go version: go1.21.11
Git commit: 662f78c
Built: Sat Jun 29 00:02:13 2024
OS/Arch: windows/amd64
Experimental: false
To manually start the service run:
Start-Service Docker
To stop Docker service execute;
Stop-Service Docker
Step 3: Run Docker Container
Start Docker Daemon before you start running and managing Docker Containers.
Start-Service Docker
Check docker service status.
PS C:\Windows\system32> Get-Service docker
Status Name DisplayName
------ ---- -----------
Running docker Docker Engine
Microsoft repository contains several base images, see Container base images for more details. Let’s see how you can download and install the base image:
Let’s download Windows Server Core image:
# 2022
docker pull mcr.microsoft.com/windows/servercore:ltsc2022
# 2019
docker pull mcr.microsoft.com/windows/servercore:ltsc2019
We can create a new container from the pulled image:
docker run -it mcr.microsoft.com/windows/servercore:ltsc2019
Step 4: Running Linux Containers
Enable Nested Virtualization if you’re running Docker Containers using Linux Virtual Machine running on Hyper-V.
Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true
Enable LinuxKit system for running Linux containers
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "1", "Machine")
Restart Docker Service after the change.
Restart-Service docker
Enable Experimental Features in Docker daemon.conf
$configfile = @”
{
“experimental”: true
}
“@
$configfile|Out-File -FilePath C:\ProgramData\docker\config\daemon.json -Encoding ascii -Force
Since Linux Containers need a Linux kernel, we need to deploy LCOW for it to run :
Invoke-WebRequest -Uri "https://github.com/linuxkit/lcow/releases/download/v4.14.35-v0.3.9/release.zip" -UseBasicParsing -OutFile release.zip
Expand-Archive release.zip -DestinationPath "$Env:ProgramFiles\Linux Containers\."
Pull a test docker image.
> docker run -it --rm ubuntu /bin/bash
root@1440a7fef7e0:/# cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy
root@1440a7fef7e0:/# exit
exit
To Switch back to running Windows containers, run:
[Environment]::SetEnvironmentVariable("LCOW_SUPPORTED", "$null", "Machine")
Enjoy running Linux and Windows containers on Windows Server 2022 or 2019. Drop us a comment in case of any issues.
Books For Learning Kubernetes Administration;
Also check:
- How to install Applications from Windows command line
- How to Allow ICMP Echo Reply on Windows Server
- How to enable Remote Desktop Protocol (RDP) on Windows Server
- How to run Linux on Windows Server 2019 with WSL
How is this different from using Docker Desktop for Windows ?
This is a better approach for server edition
I had to use this link to pull the image
mcr.microsoft.com/dotnet/samples:dotnetapp-nanoserver-1809
Thanks for sharing the note, we’ve updated the text in the article.
Hi Josphat,
It gives back the error below, but 10.0.17763 is the latest Windows Server 2019 right?
PS C:\Users\Administrator> docker run mcr.microsoft.com/dotnet/samples:dotnetapp-nanoserver-2009
Unable to find image ‘mcr.microsoft.com/dotnet/samples:dotnetapp-nanoserver-2009’ locally
dotnetapp-nanoserver-2009: Pulling from dotnet/samples
docker: a Windows version 10.0.19042-based image is incompatible with a 10.0.17763 host.
See ‘docker run –help’.
Thank you for providing the list, I didn’t see it..
Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtensions $true gives the respons:
Get-VM : The term ‘Get-VM’ is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-VM WinContainerHost | Set-VMProcessor -ExposeVirtualizationExtens …
+ ~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-VM:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
What am I doing wrong?
The Hyper-V Module for Windows PowerShell is not installed.
PS C:\Users\Administrator> docker run -it –rm ubuntu /bin/bash
Unable to find image ‘ubuntu:latest’ locally
latest: Pulling from library/ubuntu
7b1a6ab2e44d: Extracting [==================================================>] 28.57MB/28.57MB
C:\Program Files\Docker\docker.exe: failed to register layer: failed to start service utility VM (applydiff 14bdd1b0a2720d4917a811d0cbef7c71ce996a1e0f867197586ccacfe74e6cc3): container 14bdd1b0a2720d4917a811d0cbef7c71ce996a1e0f867197586ccacfe74e6cc3_svm encountered an error during CreateContainer: failure in a Windows system call: The request is not supported. (0x32) extra info: {“SystemType”:”container”,”Name”:”14bdd1b0a2720d4917a811d0cbef7c71ce996a1e0f867197586ccacfe74e6cc3_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.exe run –help’.
Did you get it to work?
I have the same problem. Did you get any clue?
Get-VM WinContainerHost
return nothing
In the linux container part along with restarting the docker service, the machine restart is also required. Atleast in my case it worked after that.
Restart-Service docker
Restart-Computer -Force
Thanks.
Noted with thanks.
I have the same problem to Alex, who has any solution?
Are these instructions still valid given transition of support? Is this now installing an older version? Do we need to be licensed for this now?
https://techcommunity.microsoft.com/t5/containers/updates-to-the-windows-container-runtime-support/ba-p/2788799
This howto is deprecated, see
https://github.com/OneGet/MicrosoftDockerProvider
and
https://learn.microsoft.com/en-us/virtualization/windowscontainers/quick-start/set-up-environment?tabs=dockerce#windows-server-1
Hi, I’m trying to follow your guide to run Linux based docker on the Win server 2019. When I try pull or run ubuntu:latest I get error:
docker : Error response from daemon: missing signature key
Please help.
I already restarted the docker service as well as the machine several times.
Trying it as an Administrator…
Thanks.
Try pulling an image from the Microsoft Container Registry
Can you have both Windows & Linux docker containers running at the same time on Server 2019? I can see here its one or the other or have I missed a section?
Hello @Bill,
We only have the Linux container running on Windows.
Hi, on W2019 I am unable to pass the very first step :
C:\Users\Administrator> Install-Package -Name docker -ProviderName DockerMsftProvider
WARNING: Cannot find path ‘C:\Users\ADMINI~1\AppData\Local\Temp\2\DockerMsftProvider\DockerDefault_DockerSearchIndex.json’ because it does not exist.
WARNING: Cannot bind argument to parameter ‘downloadURL’ because it is an empty string.
WARNING: The property ‘AbsoluteUri’ cannot be found on this object. Verify that the property exists.
WARNING: The property ‘RequestMessage’ cannot be found on this object. Verify that the property exists.
Install-Package : No match was found for the specified search criteria and package name ‘docker’. Try Get-PackageSource to see all available registered package sources.
At line:1 char:1
+ Install-Package -Name docker -ProviderName DockerMsftProvider
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power….InstallPackage:InstallPackage) [Install-Package], Exception
+ FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage
Any ideas how to proceed?
Please check updated article. It should work.
As of Docker version 23.0, the LCOW feature was removed and is no longer available with the steps indicated here currently. (https://docs.docker.com/engine/deprecated/#linux-containers-on-windows-lcow-experimental)
One could however bypass the removal, by executing the “install-docker-ce.ps1” script with the parameter “-DockerVersion 20.10.24”.
This would select the last, currently available version that supports LCOW in a deprecated state.
When an error occurs regarding “version not found”, this URL can be checked as to the latest available that is < 23.0: https://download.docker.com/win/static/stable/x86_64/
One should however be warned that one would be stuck on that version until there is another method of running Linux containers on Windows Server 2019, since 2019 doesn't support WSL 2.
Additionally, incase anyone also received an error at step "Get-VM WinContainerHost …", it might mean that the VM has not been created. To fix this, just create an empty VM without OS designation or anything, before rerunning the command:
New-VM -Name WinContainerHost -MemoryStartupBytes 1GB
(Thank to SO for this: https://stackoverflow.com/a/70619369/3864353 )
Am I meant to run docker-compose commands/build instructions in the WinContainerHost shell, or the regular shell?
Should I be running build commands/docker-compose.exe etc in the WinHostContainer shell or the regular bare metal shell?