Interview practice question
Web service starts before the database is ready
Cloud & DevOps · Docker · Intermediate
In Docker Compose, your web service crashes on startup because the database is not ready yet, even though you used depends_on. How do you fix it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- depends_on waits for start, not readiness.
- Add DB healthcheck (pg_isready).
- condition: service_healthy.
- App retries with backoff.
- restart: on-failure as safety.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.