Installing docker and Portainer on windows server on Azure VM
This guide walks through the tested and verified process for installing Docker and Portainer on a Windows Server virtual machine hosted on Microsoft Azure. These instructions are intended for production-grade setups using Windows-native Docker. To install Docker on an Azure Windows VM (for production workloads), you’ll want to install Docker Engine – Enterprise or Docker Desktop (for development). For production, it’s best to use Docker EE with Windows Server 2019 or 2022. Here’s a step-by-step guide for setting it up correctly.
✅ Prerequisites
- An Azure Windows VM (recommended: Windows Server 2019/2022)
- Administrator access (RDP)
- Internet connectivity
- VM should be updated
- VM should support Hyper-V or Containers feature
- You should have administrative access (RDP to VM as Admin)
🧰 Step-by-Step: Installing Docker on Azure Windows Server (Production)
Enable Windows Containers and Required Features
- Login via RDP to your Azure VM.
- Open PowerShell as Administrator.
- Run the following command to enable the necessary features:
Install-WindowsFeature -Name containers
Install-WindowsFeature -Name Hyper-V -IncludeManagementTools -Restart
⚠️ The VM may restart after Hyper-V is installed.
♻ Step 1: Install Docker (Manual Installation)
Since DockerMsftProvider and aka.ms links were unreliable, we used the official manual install method.
1.1 Download Docker Engine (ZIP)
Download the latest stable Docker CLI + Engine:
https://download.docker.com/win/static/stable/x86_64/docker-24.0.7.zip
1.2 Extract and Install
- Extract the ZIP to:
C:\Program Files\Docker
- Add Docker to PATH:
$env:Path += ";C:\Program Files\Docker"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [EnvironmentVariableTarget]::Machine)
1.3 Register and Start Docker
dockerd --register-service
Start-Service docker
Set-Service docker -StartupType Automatic
1.4 Verify Docker Installation
docker --version
docker info
🔒 Step 2: Enable Docker TCP API
Portainer requires Docker remote access when Docker socket is unavailable on Windows.
2.1 Edit Daemon Configuration
notepad "C:\ProgramData\Docker\config\daemon.json"
Add the following:
{
"hosts": ["tcp://0.0.0.0:2375", "npipe://"]
}
2.2 Restart Docker
Restart-Service docker
🚀 Step 3: Install Portainer
Portainer provides a web UI to manage Docker containers.
3.1 Create Portainer Data Folder
mkdir C:\portainer-data
3.2 Run Portainer Container
docker run -d -p 9000:9000 --name portainer `
--restart=always `
-v C:\portainer-data:C:\data `
portainer/portainer-ce `
-H tcp://host.docker.internal:2375
✅ Note: On Windows, avoid using
/var/run/docker.sock
. Instead, usetcp://host.docker.internal:2375
for Docker API access.
🌐 Step 4: Access Portainer
- Open browser:
http://<your-vm-public-ip>:9000
- Set up the admin password
- Connect to the local Docker endpoint using the Docker API URL
🚧 Troubleshooting Tips
- Ensure port 9000 is allowed in the Azure NSG and Windows Firewall
- Confirm Docker API is exposed on
2375
- Test connectivity with: Invoke-WebRequest http://localhost:2375/version