Docker Compose for Local Dev
Model a two-service local development stack with a compose.yaml file, add healthcheck-gated startup ordering, environment interpolation, and live-reload with Compose Watch.
Prerequisites: Completion of Dockerfile Fundamentals; Docker Compose v2 (ships as the docker compose CLI plugin with current Docker Desktop / Engine installs — verify with docker compose version).
Targeted versions: Compose Specification (top-level version: key is obsolete/ignored); Docker Compose v2 CLI plugin; verified against docs.docker.com, mid-2026.
A single Dockerfile builds one image. Real applications are usually more than one process — a web app plus a cache, a database, a background worker. Docker Compose lets you describe that whole stack declaratively in one YAML file and bring it all up with one command.
You'll build a small web service backed by Redis, wire up proper startup ordering, and turn on live file-sync so code changes show up without a manual rebuild.
Your first compose.yaml
Fix the startup race with healthchecks
Environment variables and .env
Live reload with Compose Watch
Secret Mission: modularize with include and profiles
Before You Go
Test what you just learned
Self-testing is one of the best ways to retain new skills. Unlock project quizzes to check your understanding.
Log in to unlock0 / 7 complete
