Install & Verify Docker
macOS and Windows — Docker Desktop
Section titled “macOS and Windows — Docker Desktop”Docker Desktop is the recommended installation for macOS and Windows. It bundles the Docker daemon, the CLI, Docker Compose, and a lightweight Linux VM that hosts the container runtime.
- Download Docker Desktop from https://www.docker.com/products/docker-desktop.
- Run the installer and follow the prompts.
- Launch Docker Desktop from your Applications folder (macOS) or Start menu (Windows).
- Wait for the whale icon in the menu bar / system tray to stop animating — the daemon is ready.
Docker Desktop includes Docker Compose v2 (docker compose) out of the box. No separate installation is needed.
Linux — Docker Engine
Section titled “Linux — Docker Engine”On Ubuntu or Debian, install the official Docker Engine packages:
# Add Docker's official GPG keysudo apt-get updatesudo apt-get install -y ca-certificates curlsudo install -m 0755 -d /etc/apt/keyringssudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.ascsudo chmod a+r /etc/apt/keyrings/docker.asc# Add the repository to apt sourcesecho "deb [arch=$(dpkg --print-architecture) 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 > /dev/nullsudo apt-get update# Install Docker Enginesudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-pluginFor other distributions (Fedora, RHEL, Arch) the package names and package manager differ, but the general pattern is the same: add Docker’s official repository, then install the engine, CLI, and containerd packages. The official Docker docs list distro-specific instructions.
After installation, start the daemon and optionally enable it on boot:
sudo systemctl start dockersudo systemctl enable dockerTo run Docker commands without sudo, add your user to the docker group:
sudo usermod -aG docker $USERLog out and back in for the group change to take effect.
Verifying the installation
Section titled “Verifying the installation”docker version
Section titled “docker version”docker versionExpected output (versions will differ):
Client: Docker Engine - Community Version: 26.1.4 API version: 1.45 Go version: go1.21.11 Git commit: 5650f9b Built: Wed Jun 5 11:29:39 2024 OS/Arch: linux/amd64 Context: default
Server: Docker Engine - Community Engine: Version: 26.1.4 API version: 1.45 (minimum version 1.24) Go version: go1.21.11 Git commit: fc5ddd1 Built: Wed Jun 5 11:29:39 2024 OS/Arch: linux/amd64Both a Client section and a Server section must appear. If the Server section is missing, the daemon is not running.
docker info
Section titled “docker info”docker infoThis prints the daemon’s full configuration — storage driver, number of containers and images, runtime, cgroup driver, and more. It is useful for troubleshooting and confirming the daemon is healthy.
docker run hello-world
Section titled “docker run hello-world”docker run hello-worldExpected output:
Unable to find image 'hello-world:latest' locallylatest: Pulling from library/hello-worldDigest: sha256:...Status: Downloaded newer image for hello-world:latest
Hello from Docker!This message shows that your installation appears to be working correctly.
To generate this message, Docker took the following steps: 1. The Docker client contacted the Docker daemon. 2. The Docker daemon pulled the "hello-world" image from the Docker Hub. 3. The Docker daemon created a new container from that image which runs the executable that produces the output you are currently reading. 4. The Docker daemon streamed that output to the Docker client, which sent it to your terminal.Seeing “Hello from Docker!” confirms the full pipeline is working: CLI, daemon, image pull from Docker Hub, and container execution.
docker version
docker run hello-world