Installation Guide
This guide covers installing Docker on all major platforms: Windows, macOS, and Linux. Docker Desktop is the recommended installation for development environments, while Docker Engine is recommended for production Linux servers.
System Requirements
Minimum Requirements
| Platform | Processor | RAM | Disk Space | OS Version |
|---|---|---|---|---|
| Windows | 64-bit with SLAT | 4 GB | 20 GB | Windows 10/11 (21H2+) |
| macOS | Apple Silicon or Intel | 4 GB | 20 GB | macOS 12.0+ (Monterey) |
| Linux | 64-bit (x86_64/amd64, arm64) | 2 GB | 15 GB | Kernel 3.10+ |
Windows Installation
Docker Desktop for Windows
Docker Desktop for Windows uses WSL 2 (Windows Subsystem for Linux) as the backend for running containers.
Prerequisites
- Enable WSL 2:
# Open PowerShell as Administrator
wsl --install
# Verify WSL version
wsl --list --verboseEnable Virtualization in BIOS/UEFI (Intel VT-x or AMD-V).
Enable Hyper-V (optional, WSL 2 is preferred):
# Enable Hyper-V via PowerShell
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -AllInstallation Steps
Download Docker Desktop for Windows from the official Docker website.
Run the installer (
Docker Desktop Installer.exe).During installation, ensure "Use WSL 2 instead of Hyper-V" is selected.
Follow the installation wizard to completion.
Restart your computer when prompted.
Launch Docker Desktop from the Start menu.
Post-Installation Verification
# Verify Docker is installed correctly
docker --version
# Example output: Docker version 27.x.x, build xxxxxxx
# Verify Docker Compose
docker compose version
# Example output: Docker Compose version v2.x.x
# Run the hello-world container
docker run hello-worldWindows Configuration
# Configure Docker to start on boot (via Docker Desktop settings)
# Settings > General > Start Docker Desktop when you sign in
# Configure WSL 2 resource limits
# Create or edit: %USERPROFILE%\.wslconfigExample .wslconfig file:
[wsl2]
memory=8GB
processors=4
swap=2GB
localhostForwarding=truemacOS Installation
Docker Desktop for macOS
Docker Desktop for macOS supports both Apple Silicon (M1/M2/M3) and Intel processors.
Installation Steps
Option 1: Download from Website
- Download Docker Desktop for Mac from the official Docker website.
- Select the correct version for your chip: Apple Silicon or Intel.
- Open the downloaded
.dmgfile. - Drag the Docker icon to the Applications folder.
- Launch Docker from the Applications folder.
- Accept the license agreement and complete the setup.
Option 2: Install via Homebrew
# Install Docker Desktop using Homebrew
brew install --cask docker
# Launch Docker Desktop
open /Applications/Docker.appPost-Installation Verification
# Verify Docker is installed
docker --version
# Verify Docker Compose
docker compose version
# Run the hello-world container
docker run hello-world
# Check Docker system information
docker infomacOS Resource Configuration
Configure resource limits through Docker Desktop:
- Settings → Resources → Advanced
| Setting | Recommended | Description |
|---|---|---|
| CPUs | 4+ | Number of CPU cores allocated |
| Memory | 8 GB+ | RAM allocated to Docker |
| Swap | 2 GB | Swap memory size |
| Disk image size | 60 GB+ | Maximum disk space for images and containers |
Linux Installation
Docker Engine for Linux
Docker Engine is installed directly on Linux distributions. The following instructions cover the most popular distributions.
Ubuntu / Debian
# 1. Remove any old Docker installations
sudo apt-get remove docker docker-engine docker.io containerd runc
# 2. Update package index and install prerequisites
sudo apt-get update
sudo apt-get install -y \
ca-certificates \
curl \
gnupg \
lsb-release
# 3. Add Docker's official GPG key
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | \
sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
# 4. Set up the Docker repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# 5. Install Docker Engine
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin
# 6. Verify the installation
sudo docker run hello-worldCentOS / RHEL / Fedora
# 1. Remove old Docker installations
sudo yum remove docker docker-client docker-client-latest \
docker-common docker-latest docker-latest-logrotate \
docker-logrotate docker-engine
# 2. Install prerequisites
sudo yum install -y yum-utils
# 3. Set up the Docker repository
sudo yum-config-manager --add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
# 4. Install Docker Engine
sudo yum install -y docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin
# 5. Start and enable Docker
sudo systemctl start docker
sudo systemctl enable docker
# 6. Verify the installation
sudo docker run hello-worldArch Linux
# Install Docker from the official repository
sudo pacman -S docker docker-compose docker-buildx
# Start and enable Docker
sudo systemctl start docker
sudo systemctl enable docker
# Verify
sudo docker run hello-worldPost-Installation Steps (Linux)
Run Docker as a Non-Root User
# Create the docker group (if it doesn't exist)
sudo groupadd docker
# Add your user to the docker group
sudo usermod -aG docker $USER
# Activate the group changes (or log out and back in)
newgrp docker
# Verify you can run Docker without sudo
docker run hello-worldConfigure Docker to Start on Boot
# Enable Docker to start on boot
sudo systemctl enable docker.service
sudo systemctl enable containerd.service
# Disable Docker from starting on boot
sudo systemctl disable docker.service
sudo systemctl disable containerd.serviceConfigure Docker Daemon
Create or edit /etc/docker/daemon.json:
{
"log-driver": "json-file",
"log-opts": {
"max-size": "10m",
"max-file": "3"
},
"storage-driver": "overlay2",
"default-address-pools": [
{
"base": "172.17.0.0/16",
"size": 24
}
],
"dns": ["8.8.8.8", "8.8.4.4"]
}# Restart Docker to apply changes
sudo systemctl restart dockerVerify Installation
Regardless of your platform, run these commands to verify Docker is working correctly:
# Check Docker version
docker --version
# Check Docker Compose version
docker compose version
# View system-wide information
docker info
# Run the verification container
docker run hello-world
# Run an interactive container
docker run -it alpine sh
# Inside the container:
# cat /etc/os-release
# exitTroubleshooting
Common Issues
| Problem | Platform | Solution |
|---|---|---|
| "Cannot connect to Docker daemon" | Linux | Run sudo systemctl start docker |
| "Permission denied" | Linux | Add user to docker group: sudo usermod -aG docker $USER |
| WSL 2 not installed | Windows | Run wsl --install in PowerShell as admin |
| Virtualization disabled | Windows | Enable VT-x/AMD-V in BIOS settings |
| Docker Desktop won't start | macOS | Reset Docker Desktop from troubleshoot menu |
| Slow performance | Windows/macOS | Increase memory/CPU in Docker Desktop settings |
Checking Docker Status
# Linux: Check Docker daemon status
sudo systemctl status docker
# All platforms: Test Docker connectivity
docker info
# Check Docker logs (Linux)
sudo journalctl -u docker.serviceNext Steps
- Quick Start Tutorial — Build and run your first container
- Core Concepts — Learn about images, containers, and registries
- Configuration Management — Advanced Docker daemon configuration
- Docker Engine Architecture — Understand how Docker works under the hood
- Security Best Practices — Secure your Docker installation