Menu

1 / 2

Docker Compose: depends_on and Health Checks That Actually Protect Startup (2026)

DEV Community·David Tio·6 months ago
#eZ6MP71n
#why#exercise#docker#ghost#compose
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.