DevOps Peach

Docker & Kubernetes · Getting Started with Docker · Lesson 3 of 4

Docker architecture and terms

The Docker CLI sends requests to the daemon; the daemon builds, pulls and runs images as containers; a registry stores and distributes images.

Practice interactively →

The parts

Build → Ship → Run

flowchart LR
  DF["Dockerfile + source"] -- "docker build" --> IMG["Image"]
  IMG -- "docker push" --> REG[("Registry")]
  REG -- "docker pull" --> H2["Another host"]
  H2 -- "docker run" --> C["Container"]

On Linux, Docker runs natively. On Windows/macOS, Docker Desktop runs the daemon inside a small Linux VM.

Command Meaning
docker version Client and Server (daemon) versions
docker pull nginx:1.27 Download an image from a registry
docker image ls List local images (= docker images)

If docker version prints only the Client section and then Cannot connect to the Docker daemon, the daemon is not running or your user has no access to the socket (not in the docker group).

Engine, Desktop, and installation

Docker Engine (the open-source daemon and CLI) is what you install on Linux servers, normally from Docker's own apt or dnf repository rather than the older docker.io distro package. Docker Desktop bundles Engine, a Linux VM, Compose, and a GUI for Windows and macOS; it is free for personal use, education, and small businesses, but larger companies need a paid subscription. docker info shows the storage driver, number of containers, and daemon settings.

Configuring the daemon

The daemon reads /etc/docker/daemon.json, for example to set a registry mirror, the default logging driver, or the address pool for networks. Restart it with sudo systemctl restart docker after changes. Docker contexts (docker context create, docker context use) point the CLI at another daemon over SSH, so one laptop can manage several hosts.

The socket is powerful

Anyone who can talk to /var/run/docker.sock can start a privileged container and become root on the host. Adding a user to the docker group is therefore equivalent to giving them root. Mounting the socket into a container (common for CI tools) carries the same risk. Rootless mode runs the daemon as a normal user to reduce this exposure.

Tags, digests, and platforms

A tag such as nginx:1.27 is a movable label: the publisher can point it at a new build. A digest such as nginx@sha256:... identifies exact content and never changes, so pinning by digest gives reproducible deployments. Many images are multi-arch: one tag refers to a manifest list with variants for linux/amd64 and linux/arm64, and Docker pulls the one matching your CPU. docker image inspect nginx:1.27 --format '{{.Architecture}}' shows what you got.

Command Meaning
docker info Daemon details and configuration
docker context ls Configured daemons
docker pull nginx@sha256:<digest> Pull an exact image version

Practice interactively →