Install Docker on Windows
Installing Docker on Windows requires enabling virtualization and choosing between Docker Desktop or WSL2 integration. This guide covers all installation methods.
System Requirements
- Windows 10 version 2004+ (Build 19041+)
- At least 4GB RAM
- Virtualization enabled in BIOS
- Hyper-V and Containers Windows features enabled
Prerequisites Setup
Enable Virtualization
- Restart your computer
- Enter BIOS/UEFI settings (usually F2, F12, or Delete)
- Enable Intel VT-x or AMD-V
- Save and exit
Enable Windows Features
- Open Turn Windows features on or off
- Enable:
- Hyper-V
- Windows Subsystem for Linux
- Virtual Machine Platform
- Restart your computer
Install WSL2 (Recommended)
Open PowerShell as Administrator:
wsl --installThis installs Ubuntu and WSL2. Restart after installation.
Method 1: Docker Desktop (Recommended)
Download Docker Desktop
- Visit Docker Desktop for Windows
- Download the installer
- Run the installer with administrator privileges
Installation Steps
- Check “Use WSL 2 instead of Hyper-V” (recommended)
- Complete the installation
- Restart your computer when prompted
- Launch Docker Desktop from Start Menu
Initial Configuration
- Accept Docker Desktop Service Terms
- Docker will start automatically
- Look for the whale icon in your system tray
Verify Installation
Open Command Prompt or PowerShell:
docker --version
docker compose version
docker run hello-worldMethod 2: Windows Package Manager (Winget)
winget install Docker.DockerDesktopMethod 3: Chocolatey
choco install docker-desktopDocker Desktop Configuration
WSL2 Backend (Recommended)
- Right-click Docker Desktop icon > Settings
- Go to General
- Check “Use the WSL 2 based engine”
- Click “Apply & Restart”
Resource Allocation
- Go to Settings > Resources
- Adjust as needed:
- Memory: 4GB+ (recommended 8GB)
- CPU: 2+ cores
- Disk: 64GB+
File Sharing
- Go to Settings > Resources > File Sharing
- Add your project directories
- Apply changes
Kubernetes (Optional)
- Go to Settings > Kubernetes
- Enable Kubernetes
- Wait for installation
WSL2 Integration
Check WSL2 Status
wsl -l -vSet WSL2 as Default
wsl --set-default-version 2Docker Integration with WSL2
Docker Desktop automatically integrates with WSL2. You can run Docker commands from both Windows and WSL2 terminals.
Command Line Setup
Windows Terminal (Recommended)
Install from Microsoft Store for better terminal experience with tabs and PowerShell/WSL2 integration.
PowerShell Profile Setup
# Open PowerShell profile
notepad $PROFILE
# Add Docker aliases
Set-Alias -Name d -Value "docker"
Set-Alias -Name dc -Value "docker compose"
Set-Alias -Name dps -Value "docker ps"
Set-Alias -Name di -Value "docker images"Development Environment
VS Code Integration
- Install VS Code from code.visualstudio.com
- Install Docker extension by Microsoft
- Install WSL extension for remote development
Git Integration
Install Git for Windows from git-scm.com
Common Issues and Solutions
Virtualization Not Enabled
# Check virtualization status
systeminfo | findstr "Virtualization"
# If disabled, enable in BIOSWSL2 Installation Issues
# Reset WSL
wsl --shutdown
wsl --unregister Ubuntu
wsl --installDocker Desktop Won’t Start
- Restart Docker Desktop
- Restart WSL:
wsl --shutdown - Check Windows Features are enabled
- Update Windows to latest version
Port Conflicts
# Find process using port
netstat -ano | findstr :8080
# Kill process
taskkill /PID <PID_NUMBER> /FOut of Disk Space
# Clean Docker system
docker system prune -a
# Increase disk allocation in Docker Desktop SettingsPerformance Issues
- Enable WSL2 backend in Docker Desktop
- Increase memory allocation
- Use .dockerignore files
- Optimize Dockerfile layers
Docker Compose Usage
docker-compose.yml Example
version: '3.8'
services:
web:
build: .
ports:
- "3000:3000"
volumes:
- .:/app
environment:
- NODE_ENV=development
database:
image: postgres:13
environment:
- POSTGRES_DB=myapp
- POSTGRES_USER=user
- POSTGRES_PASSWORD=password
ports:
- "5432:5432"Common Docker Compose Commands
# Start services
docker compose up -d
# View logs
docker compose logs -f
# Stop services
docker compose down
# Rebuild services
docker compose up --buildProduction Deployment
Build and Export Image
docker build -t myapp:v1.0 .
docker save -o myapp.tar myapp:v1.0Push to Registry
docker tag myapp:v1.0 username/myapp:v1.0
docker push username/myapp:v1.0Security Best Practices
Regular Updates
# Check for updates in Docker Desktop
# Settings > General > Check for updates automaticallyContainer Security
# Run containers as non-root
USER node
# Use multi-stage builds
FROM node:16-alpine as builder
# build steps
FROM node:16-alpine
COPY --from=builder /app/dist ./appSources
For other platforms, check our Docker Linux installation or macOS Docker setup.