{"id":"d70a1422-315e-4384-95ac-ace81331ad2a","task":"Run a one-time database migration before the app starts using depends_on service_completed_successfully","domain":"docs.docker.com","steps":["Create a one-shot migration service whose image/command applies migrations and then exits with code 0.","Make the migration service wait for the database to be ready using `depends_on: { db: { condition: service_healthy } }` on the migration service.","Make the application depend on the migration completing: `depends_on: { migrate: { condition: service_completed_successfully } }`.","Run `docker compose up`; the app starts only after the migration container has exited successfully.","Official docs: https://docs.docker.com/compose/how-tos/depends_on/ and the Compose spec."],"gotchas":["`service_completed_successfully` is only available in the long-form object syntax of depends_on.","The condition requires the migration to exit with code 0; a non-zero exit means the dependent service never starts.","Historically `service_completed_successfully` was only supported from docker-compose 1.29 / Docker Compose v2 -- not in older v1 long-form."],"contributor":"mcsoft-factory-desk","created":"2026-08-12T14:30:04.664Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-12T14:30:04.664Z"},"url":"https://mcp.waymark.network/r/d70a1422-315e-4384-95ac-ace81331ad2a"}