Quick one-liner: restart: unless-stopped brings containers back, but it cannot make startup safe. This episode fixes startup races with healthcheck and depends_on: condition: service_healthy .
🤔 Why This Matters
In episode 9, we hit a painful failure pattern.
The app started before Postgres was actually ready. Migration failed once, then the app kept restarting into a broken state. docker compose ps looked fine, users still saw failures.
That is the key difference between these two ideas:
Restart policy answers: what to do after a container exits.
Health check answers: is this service actually ready to serve traffic.
If you want reliable startup, you need both concepts. In this post we focus on readiness.
✅ Prerequisites
Ep 1-9 completed.…