Foreword
Read little, type a lot. In “Dockerfiles hands-on” you built three images that are small, fast and secure. This book starts where the other one ends: with three finished images, a Postgres database and the question of how to turn them into a system that starts with a single command, checks itself and runs on a server exactly the way it runs on your laptop.
On Day 0 you wire everything up by hand: one network, one volume,
five docker run with about two dozen options, and you have
to get the order right yourself. From Day 1 on you write a
compose.yaml instead and improve it day by day: your own
networks and service discovery, volumes with backup and restore,
configuration without surprises, healthchecks and a startup order that
really waits. After that it gets production-like: limits and hardening,
secrets with rotation, a reverse proxy with TLS, logs and metrics. At
the end the same file runs in a CI pipeline and over SSH on a second
Docker host, with update and rollback.
Everything runs on your laptop: Docker under Colima, no cloud
account, no public domain. You know the demo application
notes from the first book: a Go API, a Python worker and a
Node frontend. Postgres is new.
This book is for platform engineers, developers, and DevOps and
security people who don’t just use Compose for
docker compose up, but want to understand it, verify it and
use it as a reliable foundation in their team.
The training rules
- Type, don’t copy. Run every command yourself once.
- Compare with Expected. After each drill you’ll find what you should see. If it differs, that’s where the real lesson is.
- Pass the checkpoint. Only move on once every check command shows what is expected.
- Solve the challenge on your own. First the hint, then the solution.
- Lab values stay in the lab.
lab-api-key-123,lab-db-pw-123and all otherlab-…values are practice data. A real password never belongs in a file you create in this book.
Warning: All outputs in this book come from real test runs. Container IDs, times, IP addresses, image sizes and patch versions will differ on your machine. What matters is what happens: which service starts, waits, fails.
Structure of each training day
| Section | Purpose |
|---|---|
| Briefing | The essentials in a few bullet points |
| Drills | Commands with expected output |
| Checkpoint | Check script: did everything work? |
| Challenge | A task without instructions |
| Enterprise Note | What is different in production |
The training plan
| Part | Day | Unit |
|---|---|---|
| Training ground | 0 | Docker, Compose, demo application, everything wired by hand |
| A – Fundamentals | 1 | Your first compose.yaml |
| 2 | Networks and service discovery | |
| 3 | Volumes: Postgres, backup and restore | |
| 4 | Configuration: variables, .env,
configs |
|
| B – Working together | 5 | Startup order, healthchecks, migration job |
| 6 | Developing with compose watch |
|
| 7 | Multiple files: override, extends,
include, profiles |
|
| 8 | Building with Compose | |
| C – Production-like | 9 | Resources and hardening |
| 10 | Secrets and rotation | |
| 11 | Reverse proxy and TLS | |
| 12 | Observability: logs, events, metrics | |
| D – Delivery | 13 | Compose in CI |
| 14 | Deploying to a server | |
| Competition | 15 | Disaster drills |
| Appendix | A | Cheat sheet |
| B | Final exam |
Part A brings together the four building blocks of every Compose file: services, networks, volumes and configuration. Part B makes sure the services start in the right order and that you can develop quickly. Part C makes the system robust and secure. Part D gets it into the pipeline and onto a server. Day 15 trains for the real emergency.
Tip: The tested versions of Docker, Compose and all images are listed on Day 0. If an attribute behaves differently for you: check the Compose reference at
docs.docker.com/reference/compose-file/anddocker compose config, which validates every file before anything starts.
The companion code
All files from this book are publicly available on GitHub: https://github.com/thomaszachmann/docker-compose-zum-anfassen. Day 0 shows how to get them.
Let’s go.
Thomas Zachmann, 2026