Windows Server 2022 Docker Install Tutorial

In this tutorial, you will learn how to install Docker on Windows Server. We'll be showing you how to install it on Windows Server 2022, but the process is similar for earlier versions as well.

This installation guide is specifically for Windows Server. For instructions on Windows 10 and 11, click the link below.

How to Install Docker on Windows 10 & 11

Before We Begin…

Before installing Docker on Windows Server, there is something you need to be aware of:

  • Docker on Windows Server is only for Windows containers; you can’t run Linux containers on Windows Server.
  • If you want to run Linux-based containers, you'll need to install Docker on a Linux machine.
  • If you need to run Linux containers on your Windows Server, you'll have to use Hyper-V to create a Linux virtual machine and then run Docker on that VM.

Demo: Install Docker on Windows Server

Microsoft provides a PowerShell script to install Docker Engine on Windows Server.

You can download the script by running the following command:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1

Then run the script using the following command to install Docker:

.\install-docker-ce.ps1

During the installation, if you encounter errors like "Failed to start service 'Docker Engine (docker)'" or "errors during connect", terminate the installation process by pressing CTRL+C and then run the installation script again.

Failed to start service Docker Engine

Docker installation requires a restart, so your Windows Server will automatically reboot in a few moments. Once the server is back up, it will finish the installation and show the message that Docker is installed.

install docker on windows server 2022

To confirm that Docker Engine is installed, run the docker version command:

docker version

The command will display the Docker Engine version installed on your Windows Server.

Server: Docker Engine - Community
 Engine:
  Version:          26.1.4
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.11
  Git commit:       de5c9cf
  Built:            Wed Jun  5 11:28:43 2024
  OS/Arch:          windows/amd64
  Experimental:     false

Running Windows Containers

Remember, you can only run Windows containers on the Docker Engine for Windows Server.

You can find a list of official Windows-based OS images at this link.

docker container windows server

Here is an example of starting a Windows Server 2022 container using the docker run command:

docker run -dt mcr.microsoft.com/windows/servercore:ltsc2022

What Next?

Alright, now that you have Docker Engine up and running on your Windows Server, check out our tutorial on how to start containers using the docker run command.