Installing Docker on Windows
Complete guide to installing Docker Desktop on Windows. Learn how to set up WSL 2, install Docker Desktop, and configure your Windows development environment.
Prerequisites
Before installing Docker on Windows, ensure your system meets these requirements:
Windows Requirements
- Windows 10 or 11: 64-bit Pro, Enterprise, or Education (Build 19041 or higher)
- WSL 2: Windows Subsystem for Linux 2 must be enabled
- Virtualization: Hardware virtualization must be enabled in BIOS
- RAM: Minimum 4GB (8GB recommended)
Installing Docker Desktop on Windows
Docker Desktop is the easiest way to run Docker on Windows, providing a complete development environment with a user-friendly interface.
Step 1: Enable WSL 2
Open PowerShell as Administrator and run:
# Enable WSL
wsl --install
# Set WSL 2 as default version
wsl --set-default-version 2
Restart your computer after enabling WSL.
Step 2: Download Docker Desktop
Visit the official Docker website: https://www.docker.com/products/docker-desktop Click "Download for Windows" Run the installer (Docker Desktop Installer.exe)
Step 3: Install Docker Desktop
Double-click the installer to run it Ensure "Use WSL 2 instead of Hyper-V" is selected Follow the installation wizard Click "Close and restart" when prompted
Step 4: Start Docker Desktop
Launch Docker Desktop from the Start menu Accept the service agreement Wait for Docker to start (you'll see the Docker icon in the system tray) You may be asked to complete a tutorial
Step 5: Verify Installation
Open PowerShell or Command Prompt and run:
docker --version
docker run hello-world
You should see Docker's version information and a welcome message from the hello-world container.
Configuring Docker Desktop on Windows
Resources Allocation
Proper resource allocation ensures optimal performance:
CPU
- Development: 2-4 CPUs
- Production builds: 4-8 CPUs
Memory
- Minimal: 2GB
- Development: 4-8GB
- Heavy workloads: 8-16GB
Disk
- Minimal: 32GB
- Recommended: 64GB or more
Docker Desktop Settings
Access settings through the Docker Desktop menu:
-
General
- Start Docker Desktop when you log in
- Use WSL 2 based engine
- Send usage statistics (optional)
-
Resources
- Adjust CPU, Memory, Swap, and Disk limits
- Configure file sharing directories
-
Docker Engine
- Edit daemon.json for advanced configuration
- Configure registry mirrors
- Set insecure registries
-
WSL Integration
- Enable integration with your WSL 2 distros
- Select which distributions can access Docker
Troubleshooting Windows Installation
WSL 2 Not Available
Problem: "WSL 2 installation is incomplete"
Solution:
- Open PowerShell as Administrator
- Run:
wsl --install - Restart your computer
- Verify with:
wsl --status
Virtualization Not Enabled
Problem: "Hardware assisted virtualization and data execution protection must be enabled in the BIOS"
Solution:
- Restart your computer
- Enter BIOS/UEFI settings (usually F2, F10, or Del during boot)
- Find virtualization settings (Intel VT-x or AMD-V)
- Enable virtualization
- Save and exit BIOS
Docker Service Won't Start
Problem: Docker Desktop fails to start
Solution:
- Ensure WSL 2 is properly installed
- Check Windows Event Viewer for errors
- Try resetting Docker Desktop to factory defaults
- Reinstall Docker Desktop if necessary
Cannot Pull Images
Problem: "Error response from daemon: Get https://registry-1.docker.io/v2/"
Solution:
- Check internet connection
- Verify firewall settings
- Configure proxy if needed in Docker Desktop settings
Testing Your Installation
Let's verify everything works correctly:
1. Check Docker Version
docker --version
docker compose version
2. Run a Test Container
docker run -d -p 8080:80 nginx
Then visit http://localhost:8080 in your browser. You should see the Nginx welcome page!
3. List Running Containers
docker ps
4. Stop and Remove the Container
docker stop $(docker ps -q)
docker rm $(docker ps -aq)
Windows-Specific Tips
Using WSL 2 with Docker
Docker Desktop integrates seamlessly with WSL 2. You can:
- Run Docker commands from WSL 2 distributions
- Access Windows files from containers
- Use Linux-based development workflows
File Performance
For best performance:
- Store project files in the WSL 2 filesystem (not Windows filesystem)
- Access via
\\wsl$\Ubuntu\home\username\projects - Use WSL 2 terminal for development
PowerShell vs CMD
Docker works with both PowerShell and Command Prompt, but PowerShell is recommended for better scripting capabilities.
What's Next?
Now that Docker is installed on Windows, you can:
- Learn about Docker images and containers
- Build your first Docker application
- Explore Docker Compose for multi-container apps
- Set up a complete development environment
Your Docker journey on Windows has begun!