Chapter 08
Orchestration and final Docker lab
When Compose is not enough
Compose is well suited to local and single-host stacks. Cluster orchestration tools schedule workloads across hosts and provide additional rollout, service-discovery and recovery features.
docker swarm --help
docker compose --helpHands-on lab: Compare Compose, Swarm and Kubernetes at a high level.
Final practical assignment
Build a tiny Python HTTP service, package it with a Dockerfile, run it with Compose, publish one HTTP port, attach a named volume, verify logs, then tear down the stack without losing the volume.
docker compose up -d --build
docker compose ps
docker compose logs --tail 20
docker compose downHands-on lab: Deliver Dockerfile, compose.yaml, test commands, and a short explanation of data persistence.
Quick check: What is the recommended way to reproduce the environment?
Show answer
Version the Dockerfile, Compose configuration and application code; rebuild rather than manually modifying running containers.