The install instructions for Docker that show up at the top of search results are out of date often enough that I keep notes. Ubuntu's distro docker.io package is multiple major versions behind upstream and missing features (like Compose V2 as docker compose) that you actually need. The "convenience script" everyone copy-pastes was deprecated for new installs. And the macOS / Windows paths diverged enough between Apple Silicon, Intel, and WSL2 that one set of instructions does not cover all of them. Below is the path I actually use per OS.
How do I install Docker on Ubuntu, macOS, or Windows?
On Ubuntu, add Docker's official apt repository and install docker-ce, docker-ce-cli, containerd.io, docker-buildx-plugin, and docker-compose-plugin. The distro's docker.io package is months to years behind and missing the modern Compose V2 CLI; do not use it. On macOS, install Docker Desktop and pick the matching CPU build (Apple Silicon for M-series Macs, Intel for older ones). On Windows, install Docker Desktop with the WSL2 backend — that is the default and the right answer in 2026. Verify any install with docker version and run a hello-world container.
Jump to:
- Install Docker on Ubuntu (and Debian)
- Install Docker on macOS
- Install Docker on Windows
- Run Docker without sudo on Linux
- Verify the install
- Common install pitfalls
- FAQ
Install Docker on Ubuntu (and Debian)
Use Docker's official apt repository. Same shape works on Debian, Linux Mint, and Pop!_OS; substitute the codename where it appears.
# 1. Remove any old docker.io / podman-docker packages
sudo apt remove docker docker-engine docker.io containerd runc 2>/dev/null
# 2. Install prerequisites
sudo apt update
sudo apt install -y ca-certificates curl gnupg
# 3. Add Docker's 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. Add the apt source
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 + CLI + buildx + compose plugin
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io \
docker-buildx-plugin docker-compose-plugin
# 6. Start the daemon and enable it on boot
sudo systemctl enable --now dockerWhy the official apt repo and not Ubuntu's docker.io: the distro package is months or years behind upstream, and historically ships an older version of Docker Compose (or no Compose V2 at all). The official repo gives you the current Docker Engine plus docker compose (V2, the only supported version since mid-2024) plus docker buildx for multi-arch builds.
You can also use the convenience script (curl -fsSL https://get.docker.com | sh), but it is documented for evaluation and dev environments only — Docker has explicitly recommended the package-manager path for production for several years now.
After install, run Docker without sudo before going further.
Install Docker on macOS
Docker Desktop is the supported way. Pick the right CPU build:
- Apple Silicon (M1, M2, M3, M4 and later): download the Apple Silicon disk image.
- Intel-based Mac: download the Intel chip disk image.
If you grab the wrong one, the installer will refuse to run. To check your chip in advance: Apple menu → About This Mac → Chip line says either "Apple M-something" or an Intel processor name.
# Verify after install
docker version
docker run --rm hello-worldA few things specific to macOS:
- Docker Desktop runs Linux in a VM under the hood. Your containers are not native macOS processes; they are Linux containers running inside a small Linux VM that Docker Desktop manages. This is why your bind mounts behave differently than they would on Linux, and why all your images and volumes live inside a single virtual disk image rather than at paths on your Mac filesystem. The full picture is in Where Are Docker's Files on a Mac?.
- VirtioFS has been the default file-sharing mode since Docker Desktop 4.22 (August 2023) and is significantly faster than the old gRPC FUSE mode. You should not need to change anything; just be aware of it if you find tutorials online recommending the old setting.
- Rosetta-for-Linux is available in Docker Desktop 4.25+ on Apple Silicon and dramatically improves the speed of running x86 images. Enable it under Settings → General → "Use Rosetta for x86_64/amd64 emulation on Apple Silicon."
Alternatives to Docker Desktop on macOS — both legitimate, both used in production by people I know:
- OrbStack — lighter, faster, paid for commercial use over a certain size.
- Colima — open source, command-line, runs the Docker Engine in a Lima VM. Free.
Both expose the standard docker CLI, so commands you read elsewhere work unchanged. Docker Desktop is the path most people pick because it ships its own GUI and is one installer.
Install Docker on Windows
Use Docker Desktop with the WSL2 backend. WSL2 has been the default backend for years; the older Hyper-V backend is legacy and not what you want on a current Windows 10/11 install.
# 1. Enable WSL (if not already enabled)
wsl --install
# 2. Reboot when WSL asks. After reboot:
wsl --set-default-version 2
# 3. Download and install Docker Desktop from https://www.docker.com/products/docker-desktop/
# 4. On first launch, Docker Desktop asks to "Use WSL 2 instead of Hyper-V" — accept.Two things to know:
- Docker Desktop integrates with your WSL2 distros. When the installer asks which WSL2 distros to integrate with (Ubuntu, Debian, etc.), pick the one(s) you actually use. The
dockerCLI then works inside that distro's shell, talking to the engine that Docker Desktop is running. You do not need to install Docker separately inside the WSL2 distro. - Bind mounts from Windows paths are slow; bind mounts from inside WSL2 are fast. If your project lives at
C:\Users\you\code\projectand you mount it into a container, Docker has to bridge two filesystems and it is noticeably slow. Move the project into your WSL2 filesystem (\\wsl$\Ubuntu\home\you\code\project) and the bind mount becomes fast.
Run Docker without sudo on Linux
By default the docker CLI on Linux talks to /var/run/docker.sock, which is owned by root. Two ways past that.
Add yourself to the docker group (most common):
sudo usermod -aG docker $USER
# Re-login or run this to refresh your group membership for the current shell:
newgrp docker
# Then:
docker version
docker run --rm hello-worldThe newgrp docker step is what most "Cannot connect to the Docker daemon" frustration is about — adding the group is not enough on its own; you have to start a new shell session (or use newgrp) for the membership to take effect. Full breakdown of that error in Cannot Connect to the Docker Daemon.
Security note: being in the docker group is functionally equivalent to root, because you can mount the host filesystem into a container and escape. That is fine on a personal workstation; do not casually add users to this group on a multi-user server.
Rootless mode is the alternative for tighter setups. It runs the Docker daemon as your user instead of root, sandboxed to your own UID. The trade-off is no privileged ports under 1024 without extra setup, slightly slower IO, and some networking limitations. Docker's rootless install guide is the reference.
Verify the install
docker version # Client + engine versions; the engine line is what matters
docker info # Storage driver, image/container counts, host details
docker run --rm hello-worldThe hello-world container pulls a tiny image, runs it once, and prints a confirmation. If that works, the engine is reachable and the network is set up.
Common install pitfalls
- "Cannot connect to the Docker daemon" — almost always either the daemon is not running (
sudo systemctl start dockeron Linux, or Docker Desktop is not open on Mac/Windows) or you are not in thedockergroup. The dedicated page on this is Cannot Connect to the Docker Daemon. docker compose"command not found" butdocker-composeworks — you have Compose V1 still installed. Install thedocker-compose-pluginpackage and usedocker compose(with a space) going forward. See docker compose vs docker-compose.- WSL2 not available on Windows Home edition — historically yes, but WSL2 has shipped on Windows Home since version 2004 (May 2020). If
wsl --installfails, your Windows version is too old; update it. - Docker Desktop hangs at startup on Mac after an OS update — usually a stale install. Quit Docker Desktop, run
~/Library/Group\ Containers/group.com.docker/Data/com.docker.driver.amd64-linux/disk.qcow2cleanup or use Docker Desktop's Troubleshoot → Clean / Purge data. Last-resort fix is reinstall. docker.iopackage still showing up after install — you installed bothdocker.ioanddocker-ceat some point. Removedocker.io(sudo apt remove docker.io) and stick with the official package.
FAQ
Sources
Authoritative references this article was fact-checked against.
- Docker Engine on Ubuntu — install guidedocs.docker.com
- Docker Desktop for Mac — installdocs.docker.com
- Docker Desktop for Windows — installdocs.docker.com
- Docker Engine post-install on Linux (rootless, docker group)docs.docker.com



