Install Docker Desktop
Installing Docker on macOS, Linux, and Windows. Docker Desktop, Engine, Colima, Rancher Desktop. Pick the right runtime.
Docker — install
EXAMPLE
# ===== macOS ===== # Docker Desktop (commercial license for companies > 250 / USD 10M): brew install --cask docker open /Applications/Docker.app # Free alternatives: # Colima — Linux VM + Docker CLI, lightweight brew install colima docker colima start # Rancher Desktop — Docker or containerd backends, free brew install --cask rancher-desktop # ===== Linux (Ubuntu / Debian) ===== sudo apt update sudo apt install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc echo "deb [signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \ $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin # Add yourself to the docker group (logout/login after): sudo usermod -aG docker $USER # Fedora / RHEL: sudo dnf install -y docker-ce # Arch: sudo pacman -S docker # ===== Windows ===== # Docker Desktop (with WSL 2 backend): winget install Docker.DockerDesktop # Requires WSL 2; the installer walks you through enabling it. # ===== Verify ===== docker --version docker compose version docker run --rm hello-world # ===== Post-install niceties ===== # Auto-start: most installers do this # Configure resource limits (Desktop: Settings -> Resources) # Enable BuildKit (default in modern Docker): faster builds # ===== Login to registries ===== docker login # Docker Hub docker login ghcr.io -u <github-user> # GitHub Container Registry docker login 1234.dkr.ecr.region.amazonaws.com # ECR (use aws ecr get-login-password) # ===== Pull + run ===== docker pull nginx:1.27-alpine docker run --rm -p 8080:80 nginx:1.27-alpine # http://localhost:8080 # ===== Build a small image ===== mkdir hello && cd hello cat > Dockerfile <<'EOF' FROM nginx:1.27-alpine COPY index.html /usr/share/nginx/html/index.html EOF echo '<h1>hi</h1>' > index.html docker build -t hello-nginx . docker run --rm -p 8080:80 hello-nginx # ===== Cleanup ===== docker ps # running docker ps -a # all (incl stopped) docker images docker system df # disk usage docker system prune -a # remove unused images / containers / volumes # ===== Patterns to internalise ===== # - Add your user to the docker group on Linux (no sudo) # - Use BuildKit (default) for faster builds # - Pull base images by digest in prod # - Set resource limits explicitly on Desktop # ===== Pitfalls ===== # - Forgetting to logout/login after groupadd -> permission denied # - Docker Desktop EULA on companies > 250 employees # - Pulling 'latest' tags -> non-reproducible builds # - Mounting your home dir into a container without thought (leaks)
Why it matters
Pick a runtime that matches your platform and your wallet. Docker Desktop for ease, Colima / Rancher / Engine for free. Verify with hello-world, login to the registries you use, and add your user to the docker group on Linux. The first 30 minutes save weeks of friction.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Example
Example
# macOS / Windows — Docker Desktop # Linux — install Docker Engine (apt / dnf) docker --versionTry it Yourself »
Discussion
Loading…