Skip to content

// cheat sheets / docker-concepts

Docker concepts

How Docker works: the client and daemon, images and layers, registries, networks, volumes and Compose

ConceptsBeginner#docker#containers#devops

1. Client, daemon and containers

  • docker CLI — The client: every docker command is a request to the daemon's API.
  • dockerd — The daemon builds images, runs containers and manages networks and volumes.
  • containerd — The runtime underneath that starts and stops the container processes.
  • Container — A process isolated by namespaces and cgroups, sharing the host's kernel.
Diagram for Client, daemon and containers: docker CLI → dockerd (REST API); dockerd → Container A (runs); dockerd → Container B (runs): dockerd in Docker host; Container A in Docker host; Container B in Docker host.
Open this diagram in archhy

A container is a process on the host, not a small virtual machine.

2. Images and layers

  • Image — A read-only template: a stack of layers plus settings such as the start command.
  • Layer — Each Dockerfile instruction adds a layer; unchanged layers come from the build cache.
  • Container layer — A thin writable layer on top, lost when the container is removed.
  • Tag — A name for one image, such as nginx:1.27; latest is only a default name.
Diagram for Images and layers: Base image layer → Dependencies layer; Dependencies layer → App code layer; App code layer → Writable layer (container).
Open this diagram in archhy

Order a Dockerfile from least to most often changed to keep the cache.

3. Registries

  • Registry — A server that stores images: Docker Hub, Amazon ECR, GitHub Container Registry.
  • Repository — One image's versions in a registry, told apart by tag.
  • push and pull — push uploads your image's layers; pull downloads only the layers a host lacks.
  • Digest — The sha256 of an image's content: pin it when you need exactly the same image.
Diagram for Registries: Build machine → Registry (push); Registry → Server (pull); Registry → CI runner (pull).
Open this diagram in archhy

4. Networking

  • bridge — The default: containers on one host share a private network behind NAT.
  • Your own bridge — Containers on it find each other by name through Docker's DNS.
  • Publishing a port — -p 8080:80 sends the host's port 8080 to the container's port 80.
  • host and none — host shares the host's network; none gives the container no network.
Diagram for Networking: Browser → Host port 8080 (8080); Host port 8080 → web (:80); web → db (db:5432): web in my-net bridge; db in my-net bridge.
Open this diagram in archhy

Create your own network so containers can call each other by name.

5. Volumes and bind mounts

  • Volume — Storage Docker manages in its own area; it outlives the container.
  • Bind mount — A host folder mounted into the container: handy for code while developing.
  • tmpfs — Memory-only storage for scratch files, gone when the container stops.
  • The rule — Data you must keep goes in a volume, never in the container's writable layer.
Diagram for Volumes and bind mounts: Container → Volume my-data (/var/lib/data); Container → Host folder ./src (/app).
Open this diagram in archhy

6. Docker Compose

  • compose.yaml — One file describing the app's services, networks and volumes.
  • Service — A container definition: image or build, ports, environment and volumes.
  • Network — Compose puts the services on one network, so they reach each other by name.
  • up and down — docker compose up starts everything; down stops and removes it.
Diagram for Docker Compose: web → api (http); api → db (sql); db → db-data volume: web in Compose project; api in Compose project; db in Compose project.
Open this diagram in archhy

One command brings up the whole app the same way on every machine.

archhyarchhy.com/cheat-sheets/docker-conceptsMake your own at archhy.com

Draw your own, with real cloud icons.

Start drawing, free

No account needed to start.