Before we run our first container, it helps to understand how Docker is structured. The "Docker" you install is actually several cooperating components.
The Components
- Docker CLI (
docker): The command-line tool you type into. It sends requests to the daemon. - Docker daemon (
dockerd): A background service that manages images, containers, networks, and volumes. The CLI talks to it over a Unix socket (or TCP). - containerd: The lower-level runtime the daemon delegates to. It pulls images, manages container lifecycles, and calls runc to start processes.
- runc: The lowest-level runtime — actually creates the namespaces and cgroups for a container.
- Registry: Where images live. Docker Hub is the default public registry; you can also use private registries.
docker CLI ──▶ dockerd ──▶ containerd ──▶ runc ──▶ process
You typically only think about the CLI and the daemon — but knowing the layers helps when you read about Kubernetes (which talks to containerd directly, skipping dockerd) or about rootless container runtimes.
Installing Docker
macOS and Windows
Install Docker Desktop from docker.com/products/docker-desktop. It bundles the engine, CLI, Compose, a small Linux VM (since macOS and Windows don't have a Linux kernel natively), and a GUI dashboard. Free for personal use and small businesses.
Linux
Install Docker Engine via your distribution's package manager. On Debian/Ubuntu:
curl -fsSL https://get.docker.com | sh
sudo usermod -aG docker $USER # so you can run docker without sudo
newgrp docker # apply group change in current shell
On Red Hat / Fedora / Amazon Linux, packages are available in the official Docker repos.
Alternatives
- Podman — drop-in CLI replacement, rootless and daemonless, default on Red Hat / Fedora.
- colima — lightweight Docker Desktop alternative for macOS.
- Rancher Desktop — open-source desktop that bundles containerd and Kubernetes.
Verify Your Installation
docker --version
docker info # shows daemon details
docker run hello-world
The hello-world command does several things at once: the daemon checks if the image is local; if not, it pulls it from Docker Hub; it creates a container from that image; runs it (which prints a welcome message); and exits. If you see the welcome text, every layer of the stack works.
Common Commands at a Glance
| Command | What it does |
|---|---|
docker run IMAGE | Start a new container from an image |
docker ps | List running containers |
docker ps -a | List all containers (including stopped) |
docker images | List local images |
docker pull IMAGE | Download an image from a registry |
docker stop ID | Stop a running container |
docker rm ID | Remove a stopped container |
docker rmi IMAGE | Remove an image |
docker logs ID | View a container's stdout/stderr |
docker exec -it ID bash | Open a shell inside a running container |
The next lesson dives deeper into images — how they are layered, how to pull them, and how registries work.