Skip to content

Docker Compose for Mere Mortals

One container is a toy; real applications are several — a web server, a database, maybe a cache. Docker Compose describes the whole stack in a single YAML file and runs it as one unit: docker compose up and everything starts, in order, on its own network, with its data volumes attached.

This guide picks up where Docker for Mere Mortals leaves off. It assumes you know what an image and a container are, and that Docker itself is installed. Everything Compose adds on top — the file format, services, networks, volumes, environment, healthchecks, and the daily command set — is explained from zero.

What this guide covers

What it doesn't cover

Kubernetes and Swarm (multi-machine orchestration), writing Dockerfiles (see the Docker guide), and production hardening (TLS, secrets managers, registries with authentication). This guide is about running a stack on one machine, well.

How to use this guide

Every compose.yaml in these chapters was validated with docker compose config against the real thing — Check: blocks show what success looks like. Type the files yourself; YAML punishes copy-paste indentation errors the same either way, and typing teaches the shape.

Validation notes

  • All compose files were parsed and rendered with Docker Compose v5.6.0 (docker compose config); outputs shown are the actual outputs.
  • Quoted error messages in Troubleshooting were reproduced with Compose v5.6.0 unless marked otherwise.
  • up/down runs were not performed here — the build machine's kernel cannot run the Docker daemon (no bridge networking support), so container lifecycle commands are documented from the official Compose reference, not from live runs. config, which is the validation that matters for file correctness, needs no daemon and was run on every sample.
  • Version-sensitive facts were verified in October 2026; treat them as "check again in a year."