HomeChallengesRepsProblemsLeaderboardTake a challenge

Compose With a Database

An API and a Postgres, wired so the API does not start against a database that is not ready and the data does not vanish on `docker compose down`.

Intermediate20 min on the clock5 graded checks · 100 pointsDocker + Deploy SprintPro
Graded by reading your code against the checklist below.

What you build

  • Give the database a healthcheck that means "accepting queries"
  • Make the API wait for that health, not merely for the container to start
  • Put the data in a named volume so it survives `down`
  • Take the password from the environment, never inline
  • Restart both services unless they were stopped deliberately

Done means

docker compose up starts cleanly from cold, and down then up still has yesterday data.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. The database reports when it is actually ready+20Running it in production
  2. Wait for health, not for start+25Rate limiting and cancellation
  3. Keep the data in a named volume+20Querying a database
  4. Take the password from the environment+20Settings, not string literals
  5. Restart unless stopped deliberately+15Rate limiting and cancellation

What it teaches

The rest of Docker + Deploy Sprint