Lab: Docker Compose Quickstart
Table of contents
Build a Python Flask and Redis hit-counter app using Docker Compose, starting
from a bare compose.yaml and progressively adding production-quality
features at each step.
Launch the lab
Start the labspace:
$ docker compose -f oci://dockersamples/labspace-compose-quickstart up -dOpen your browser to http://localhost:3030.
What you'll learn
By the end of this Labspace, you will have completed the following:
- Define a multi-service application in a
compose.yamlfile and manage it with Compose commands - Control service startup order using health checks and
depends_onconditions - Iterate on code without manual rebuilds using Compose watch mode
- Persist data across container restarts with named volumes
- Modularize a stack across multiple files using the
includedirective - Use
config,logs, andexecto inspect and debug a running stack
Modules
| # | Module | Description |
|---|---|---|
| 1 | Introduction | Tour the starter app and verify the environment |
| 2 | Defining Services | Write the first compose.yaml and bring up the Flask and Redis stack |
| 3 | Health Checks & Startup Order | Add a Redis healthcheck and depends_on to eliminate race conditions |
| 4 | Live Development with Watch Mode | Configure watch mode to sync code changes without manual rebuilds |
| 5 | Persistence & Debugging | Add a named volume so Redis data survives docker compose down |
| 6 | Using Multiple Compose Files | Extract Redis into infra.yaml and compose files with include |
| 7 | Additional Commands | Use config, logs -f, and exec to inspect the running stack |
| 8 | Recap | Review what was built and explore next steps |