LearnAI ToolsCareerPractice BuildsPlayDevelopmentContact
Lesson 212 min read

Installing Docker on Windows, macOS and Linux

Install Docker Desktop on Windows or macOS, or Docker Engine on Linux, check the installation, and fix the common “permission denied” error.

On this page 11 sections

Introduction

Before you can run containers, you need Docker on your computer. This lesson covers the recommended installation for each operating system, how to confirm that everything works, and the first error almost every Linux user meets.

What You Will Learn
  • The difference between Docker Desktop and Docker Engine.
  • How to install Docker on Windows, macOS and Ubuntu.
  • How to check your installation with docker version and hello-world.
  • Why you might see “permission denied” on Linux, and how to fix it safely.

Docker Desktop or Docker Engine?

Docker DesktopDocker Engine
Runs onWindows, macOS, LinuxLinux
What it isAn app with a graphical dashboard; runs Docker inside a small Linux virtual machineThe Docker daemon and command-line tools, installed directly on Linux
IncludesEngine, CLI, Compose, Buildx and a GUIEngine, CLI; Compose and Buildx as plugins
CostFree for personal use, education and small businessesFree and open source
Use it forYour Windows or Mac laptopLinux servers, cloud machines and Linux desktops

Both give you the same docker command, and every command in this course works with either.

Windows

  • Make sure you are on Windows 10 or 11, 64-bit, with virtualisation enabled (most modern PCs have it on).
  • Install WSL 2 if you do not have it: open PowerShell as Administrator and run wsl --install, then restart.
  • Download Docker Desktop for Windows from docker.com and run the installer, keeping the “Use WSL 2” option selected.
  • Start Docker Desktop and wait until it says the engine is running.
  • Open a terminal — PowerShell, or your Ubuntu (WSL) terminal — and run docker run hello-world.
Use Docker from WSL

In Docker Desktop’s settings, under Resources → WSL integration, enable your Ubuntu distribution. You can then use docker from the Ubuntu terminal and keep your project files inside Linux, which is noticeably faster than working from C:\.

macOS

  • Download Docker Desktop for Mac from docker.com, choosing the Apple silicon or Intel chip version to match your Mac.
  • Open the .dmg file and drag Docker to Applications.
  • Start Docker from Applications and accept the prompts.
  • Open Terminal and run docker run hello-world.
Apple Silicon Macs

Macs with M-series chips use the ARM architecture. Most popular images, including all the ones in this course, are published for both ARM and Intel, and Docker picks the right one automatically.

Linux (Ubuntu)

On Linux, install Docker Engine from Docker’s official apt repository. (Ubuntu’s own docker.io package works too, but is often an older version.) First, add Docker’s signing key and repository:

sudo apt-get update
sudo apt-get 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
sudo chmod a+r /etc/apt/keyrings/docker.asc
echo "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/null

Then install Docker Engine, the command-line client, containerd and the Buildx and Compose plugins:

sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

On Ubuntu the Docker service starts automatically after installation, and starts again every time the computer boots. Docker’s documentation has equivalent instructions for Debian, Fedora, RHEL and other distributions — only the package manager commands differ.

Check the Installation

The quickest check prints the versions of Docker and Compose:

docker --version
docker compose version
Output

Click Run to see what this code prints.

docker version shows both halves of Docker — the client you type commands into and the server (the daemon). If the Server section is missing and you see an error instead, the daemon is not running: start Docker Desktop, or on Linux run sudo systemctl start docker.

docker version
Output

Click Run to see what this code prints.

docker info reports how Docker is set up — its plugins, how many containers and images you have, where data is stored and more. The first lines list the installed plugins:

docker info | head -n 12
Output

Click Run to see what this code prints.

Finally, run hello-world as in lesson 1. If you see “Hello from Docker!”, your installation is complete.

Fixing “permission denied”

On Linux, the Docker daemon runs as root and only accepts commands from root or members of the docker group. A new user who is not in that group sees this:

docker ps
Output

Click Run to see what this code prints.

You could put sudo in front of every docker command, but the usual fix is to add your user to the docker group once:

sudo usermod -aG docker $USER

Group membership is read when you log in, so log out and back in (or run newgrp docker in the current terminal). Then check your groups and try again:

groups
docker ps
Output

Click Run to see what this code prints.

An empty table with just the headings is the correct result: it means Docker answered, and you have no containers running yet.

The docker Group Is Powerful

Anyone in the docker group can start a container that mounts the whole filesystem as root, so membership is effectively root access. Add only trusted users — never a shared or public account. Docker Desktop on Windows and macOS does not need this step.

Mini Challenge · Fix the Command

On a new Ubuntu server, docker ps prints “permission denied while trying to connect to the docker API”. Which fix is best?

Choose one answer

Common Mistakes

Avoid These Mistakes
  • Running docker commands before Docker Desktop has finished starting — wait for the “Engine running” status.
  • Forgetting to log out and back in after joining the docker group, then thinking the fix did not work.
  • Installing both Docker Desktop and Docker Engine inside WSL — use one or the other.
  • Disabling virtualisation in the BIOS, which Docker Desktop needs on Windows.

Frequently Asked Questions

Docker itself is small, but images add up — plan for at least 10–20 GB of free space for learning. 8 GB of RAM is comfortable; Docker Desktop lets you limit how much memory its virtual machine uses.

Yes. A cheap or free-tier cloud Linux server works well, and some online playgrounds give you a temporary Docker host in the browser.

Podman is an alternative container engine with a largely compatible command line (podman run, podman build). The concepts in this course apply to it too, but the course uses Docker.

Key Takeaways

  • Use Docker Desktop on Windows and macOS, and Docker Engine on Linux.
  • On Ubuntu, install from Docker’s official apt repository for an up-to-date version.
  • docker version shows the client and the daemon; a missing Server section means the daemon is not running.
  • On Linux, join the docker group to avoid sudo — and remember it is equivalent to root access.

Summary

Docker is installed and working. Next you will learn the everyday commands for running, inspecting, stopping and removing containers.

Next Lesson →

Running Containers: run, ps, logs, exec and stop