Installing Docker
4. Installing Docker
Section titled “4. Installing Docker”🪟 Windows
Section titled “🪟 Windows”# Step 1: Enable WSL2 (Windows Subsystem for Linux)wsl --install
# Step 2: Download Docker Desktop from:# https://docs.docker.com/desktop/install/windows-install/
# Step 3: Run the installer and restart
# Step 4: Verify installationdocker --versiondocker run hello-worldNote: Docker Desktop on Windows uses WSL2 backend. Enable it in Settings → General → “Use the WSL2 based engine”.
🐧 Linux (Ubuntu/Debian)
Section titled “🐧 Linux (Ubuntu/Debian)”# Step 1: Update package indexsudo apt-get update
# Step 2: Install prerequisitessudo apt-get install -y \ ca-certificates \ curl \ gnupg \ lsb-release
# Step 3: Add Docker's official GPG keysudo mkdir -p /etc/apt/keyringscurl -fsSL https://download.docker.com/linux/ubuntu/gpg | \ sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Step 4: Add Docker repositoryecho \ "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \ https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) stable" | \ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Step 5: Install Docker Enginesudo apt-get updatesudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Step 6: Run Docker without sudo (optional but recommended)sudo usermod -aG docker $USERnewgrp docker
# Step 7: Start Docker servicesudo systemctl start dockersudo systemctl enable docker
# Verifydocker --versiondocker run hello-world🍎 macOS
Section titled “🍎 macOS”# Option 1: Docker Desktop (GUI + CLI)# Download from: https://docs.docker.com/desktop/install/mac-install/
# Option 2: Homebrewbrew install --cask docker
# Start Docker Desktop, then verify:docker --versiondocker run hello-world✅ Verification Commands
Section titled “✅ Verification Commands”# Check Docker versiondocker --version# Output: Docker version 24.0.5, build ced0996
# Check Docker infodocker info
# Run the test containerdocker run hello-world
# Check if daemon is runningsudo systemctl status docker # Linux