12 questions to validate Docker Compose: compose file and YAML, up/down/logs driving, wired mini-application, variables and profiles, breakage-free troubleshooting.
Answer everything, then click Check: your score and explanations will appear.
3.1 · Recall
1. What does a service declare in a compose.yml?
One service = image + ports + env + volumes + network.
3.1 · Application
2. Idir writes ports: [8080:80] without quotes and the stack fails. Why?
Always quote ports in YAML: 80% of errors come from there.
3.2 · Recall
3. What is the difference between down and down -v?
down alone = safe stop; -v = reset wiping volumes.
3.2 · Application
4. Idir edits his code, reruns up -d, but the old code still runs. What to do?
Without --build, Compose reuses the existing image.
3.3 · Application
5. Which ports does Idir publish on his api + database + adminer mock-up?
Minimal surface: only what is needed goes out, the database stays internal.
3.3 · Application
6. Idir's api crashes on the first up then passes on the second. Diagnosis and fix?
depends_on orders without waiting: retry absorbs startup.
3.4 · Recall
7. What does ${PORT:-3000} mean in a compose.yml?
Interpolation: PORT value, else the prod-safe default 3000.
3.4 · Application
8. Idir wants adminer in dev but never in prod, without duplicating the file. He uses…
Opt-in profile: absent by default, explicitly enabled in dev.
3.5 · Application
9. "port already allocated" at up: Idir checks and finds an old manual run. He…
Conflict on the host: left moved or occupant freed.
3.3 · Arbitration
10. For prod, a colleague suggests the URL and password hard-coded in the committed compose. Decision?
Never a hard-coded committed secret: variable + managed secret.
3.4 · Arbitration
11. Two copied compose.yml files (dev/prod) diverge and the dev console nearly went to prod. Decision?
One base, values per env, differences in overrides.
3.5 · Arbitration
12. Broken stack before a demo: a colleague suggests down -v "to restart clean". Decision?
Never -v in panic: diagnose first, recreate targeted.
What's next?
Score ≥ 80%: move to Level 4 — registries, healthchecks, advanced networks and volume backup (harden what Compose starts).
Score 50-79%: review the missed sections (YAML and config in 3.1, down cycle in 3.2, names and retry in 3.3, profiles in 3.4, diagnosis in 3.5) then retake the test.
Score < 50%: replay each 48h challenge in order — validated stack, lossless cycle, persisted mini-app, unified base, failure fixed without -v.