Docker Installation & Setup
Setting up Docker is the first step to start containerizing your applications. This guide covers installation on all major operating systems.
System Requirementsβ
Windowsβ
- Windows 10 64-bit: Pro, Enterprise, or Education (Build 15063 or later)
- Windows 11 64-bit: Home or Pro version 21H2 or higher
- WSL 2 feature enabled
- Hyper-V and Containers Windows features enabled
macOSβ
- macOS 10.15 or newer
- 4 GB RAM minimum
- VirtualBox prior to version 4.3.30 must be uninstalled
Linuxβ
- 64-bit kernel and CPU support for virtualization
- KVM virtualization support
- QEMU version 5.2 or newer
- systemd init system
Windows Installationβ
Method 1: Docker Desktop (Recommended)β
Step 1: Download Docker Desktop
- Visit Docker Desktop for Windows
- Click "Download for Windows"
- Run the installer
Docker Desktop Installer.exe
Step 2: Installation Process
- Follow the installation wizard
- Ensure "Use WSL 2 instead of Hyper-V" is checked
- Complete the installation and restart your computer
Step 3: Enable WSL 2
# Run in PowerShell as Administrator
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
# Restart your computer, then set WSL 2 as default
wsl --set-default-version 2
Step 4: Verify Installation
docker --version
docker run hello-world
macOS Installationβ
Docker Desktop for Macβ
Step 1: Download
- Visit Docker Desktop for Mac
- Choose your chip type:
- Apple Silicon (M1/M2): Mac with Apple chip
- Intel: Mac with Intel chip
Step 2: Install
- Open the downloaded
.dmgfile - Drag Docker to Applications folder
- Launch Docker from Applications
- Follow the setup assistant
Step 3: Verify Installation
docker --version
docker run hello-world
Alternative: Homebrew Installationβ
# Install Docker using Homebrew
brew install --cask docker
# Start Docker Desktop
open /Applications/Docker.app
Linux Installationβ
Ubuntu/Debianβ
Step 1: Update Package Index
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
Step 2: Add Docker's GPG Key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
Step 3: Add Docker Repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Step 4: Install Docker
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Step 5: Add User to Docker Group
sudo usermod -aG docker $USER
newgrp docker
CentOS/RHEL/Fedoraβ
Step 1: Install Required Packages
sudo yum install -y yum-utils
Step 2: Add Docker Repository
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
Step 3: Install Docker
sudo yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Step 4: Start Docker Service
sudo systemctl start docker
sudo systemctl enable docker
sudo usermod -aG docker $USER
Verification & Testingβ
Basic Verificationβ
# Check Docker version
docker --version
# Check Docker Compose version
docker compose version
# View system information
docker system info
# Test with hello-world
docker run hello-world
Advanced Testingβ
# Run a simple web server
docker run -d -p 8080:80 --name test-nginx nginx
# Check if it's running
docker ps
# Test in browser: http://localhost:8080
# Clean up
docker stop test-nginx
docker rm test-nginx
Docker Desktop Featuresβ
Dashboardβ
- Visual container management
- Image browsing and management
- Volume and network management
- Extension marketplace
Settings Configurationβ
- Resources: Adjust CPU, Memory, Swap, Disk usage
- File Sharing: Configure shared directories
- Proxies: Set up corporate proxy settings
- Docker Engine: Advanced daemon configuration
Useful Commandsβ
# Start Docker Desktop
# Windows: Start from Start Menu
# macOS: Open from Applications
# Linux: systemctl start docker
# Check Docker Desktop status
docker system info
# Update Docker Desktop
# Use built-in updater or download latest version
Troubleshooting Common Issuesβ
Windows Issuesβ
WSL 2 Installation Failed
# Enable Windows features manually
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform
# Download and install WSL 2 kernel update
# https://aka.ms/wsl2kernel
Docker Desktop Won't Start
- Ensure Hyper-V is enabled
- Check Windows version compatibility
- Restart Docker Desktop service
macOS Issuesβ
Permission Denied
# Fix Docker socket permissions
sudo chown $USER /var/run/docker.sock
Resource Allocation
- Increase memory allocation in Docker Desktop settings
- Close other resource-intensive applications
Linux Issuesβ
Permission Denied
# Add user to docker group
sudo usermod -aG docker $USER
# Log out and log back in
Docker Daemon Not Running
# Start Docker service
sudo systemctl start docker
sudo systemctl enable docker
# Check status
sudo systemctl status docker
Next Stepsβ
Now that Docker is installed and running:
- β Learn Docker Commands - Master essential Docker CLI commands
- β Create Your First Dockerfile - Build custom images
- β Explore Docker Hub - Find and use existing images
- β Try Docker Compose - Manage multi-container applications
Congratulations! π You now have Docker running on your system. Ready to start containerizing applications!
Quick Referenceβ
Installation Commands Summaryβ
Ubuntu/Debian:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER
CentOS/RHEL:
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo systemctl start docker
sudo usermod -aG docker $USER
Verification:
docker --version && docker run hello-world