Find us on social media
DockerContainersWindows7 min read
Install Docker on Windows Server
Install Docker on Windows Server to run Windows and Linux containers.
Docker on Windows Server lets you run native Windows containers and, with WSL2, Linux containers as well.
Step 1 — Install the Containers feature
powershell
Install-WindowsFeature -Name Containers -RestartThe server restarts automatically.
Step 2 — Install Docker Engine
After reboot:
powershell
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1
.\install-docker-ce.ps1Or with the DockerMsftProvider module:
powershell
Install-Module -Name DockerMsftProvider -Repository PSGallery -Force
Install-Package -Name docker -ProviderName DockerMsftProvider -Force
Restart-ComputerStep 3 — Verify installation
powershell
docker version
docker infoStep 4 — Run your first container
powershell
# Windows container
docker run --rm mcr.microsoft.com/windows/nanoserver:ltsc2022 cmd /c "echo Hello from Docker"
# IIS container
docker run -d -p 8080:80 --name web mcr.microsoft.com/windows/servercore/iisStep 5 — Basic commands
powershell
# List containers
docker ps -a
# View logs
docker logs web
# Stop container
docker stop web
# Remove container
docker rm web
# List images
docker imagesStep 6 — Configure Docker as a service
powershell
# Verify the service is running
Get-Service docker
# Set automatic startup
Set-Service -Name docker -StartupType AutomaticStep 7 — Docker Compose
powershell
# Docker Compose is included with Docker Desktop
# For Windows Server, download the binary:
Invoke-WebRequest "https://github.com/docker/compose/releases/latest/download/docker-compose-windows-x86_64.exe" -OutFile "C:\Program Files\Docker\docker-compose.exe"Docker on your Baires Host Windows VPS lets you containerize applications for consistent and reproducible deployments.
Was this guide helpful?