Installing Docker
Docker is available for Windows, macOS, and Linux. This lesson covers installation on each platform and verification steps.
Installation Options
Docker offers two main products:
| Product | Use Case | Platforms |
|---|---|---|
| Docker Desktop | Development | Windows, macOS, Linux |
| Docker Engine | Production servers | Linux only |
Installing Docker Desktop
Docker Desktop is the recommended option for developers. It includes Docker Engine, Docker CLI, Docker Compose, and a graphical interface.
macOS Installation
- Download Docker Desktop from docker.com/products/docker-desktop
- Open the .dmg file and drag Docker to Applications
- Launch Docker from Applications
- Complete setup by following the prompts
System Requirements:
- macOS 12 or newer
- Apple Silicon (M1/M2/M3) or Intel chip
- 4GB RAM minimum
Windows Installation
- Enable WSL 2 (Windows Subsystem for Linux 2)
wsl --install - Download Docker Desktop from docker.com
- Run the installer and follow prompts
- Restart your computer when prompted
- Launch Docker Desktop
System Requirements:
- Windows 10/11 (64-bit)
- WSL 2 enabled
- 4GB RAM minimum
Linux Installation (Ubuntu/Debian)
For Linux, you can install Docker Engine directly:
# Update package index
sudo apt-get update
# Install prerequisites
sudo apt-get install ca-certificates curl gnupg
# 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
# Set up the 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
# Install Docker Engine
sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
Verifying Installation
After installation, verify Docker is working correctly:
# Check Docker version
docker --version
# Expected output:
# Docker version 24.0.x, build xxxxxxx
# Check Docker Compose version
docker compose version
# Expected output:
# Docker Compose version v2.x.x
# Run the hello-world container
docker run hello-world
The hello-world container output confirms Docker is properly installed:
Hello from Docker!
This message shows that your installation appears to be working correctly.
...
Post-Installation Steps (Linux)
On Linux, add your user to the docker group to run Docker without sudo:
# Create docker group (if it doesn't exist)
sudo groupadd docker
# Add your user to docker group
sudo usermod -aG docker $USER
# Apply the group change
newgrp docker
# Verify you can run without sudo
docker run hello-world
Docker Desktop Features
Docker Desktop includes several useful features:
GUI Dashboard
- View running containers
- Manage images and volumes
- Monitor resource usage
- Access logs and terminal
Extensions
- Add functionality through Docker extensions
- Popular extensions: Disk Usage, Logs Explorer, Portainer
Settings
- Resource allocation (CPU, memory, disk)
- Network configuration
- Kubernetes integration
- Experimental features
Resource Configuration
Configure resources in Docker Desktop settings:
| Resource | Development | Light Use |
|---|---|---|
| CPUs | 4+ | 2 |
| Memory | 8GB+ | 4GB |
| Disk | 64GB+ | 32GB |
| Swap | 2GB | 1GB |
Common Installation Issues
Docker daemon not running
# Check Docker service status
sudo systemctl status docker
# Start Docker service
sudo systemctl start docker
# Enable on boot
sudo systemctl enable docker
Permission denied
# On Linux, ensure you're in the docker group
groups $USER
# If docker is not listed, add yourself
sudo usermod -aG docker $USER
# Log out and back in for changes to take effect
WSL 2 issues (Windows)
# Update WSL
wsl --update
# Set default version to 2
wsl --set-default-version 2
Uninstalling Docker
macOS
- Open Docker Desktop
- Select "Troubleshoot" → "Uninstall"
- Drag Docker from Applications to Trash
Windows
- Open Settings → Apps
- Find Docker Desktop
- Click Uninstall
Linux
sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
Key Takeaways
- Docker Desktop is recommended for development on Windows and macOS
- Linux users can install Docker Engine directly
- Always verify installation with
docker --versionanddocker run hello-world - On Linux, add your user to the docker group for convenience
- Configure resource limits based on your workload needs

