Docker Compose depends_on ordering lacking readiness guarantee
0 reputation · 22 Aug 2023, 08:32 UTC
Goal: Configure a Docker Compose application so that a dependent service starts only after its prerequisite service is fully ready to accept connections.
Constraint: The depends_on directive in Compose files version 3.x guarantees only start order, not that the prerequisite has completed initialization or is listening on its ports. Health‑checks can be defined but Compose does not use them to gate the start of dependent services, leaving a gap that requires external workarounds such as retry loops or init containers.
Uncertainty: Whether a native Compose option exists to make depends_on wait for a service’s health status to become healthy, or if future versions will incorporate readiness‑based ordering without external scripting.
- What configuration or flag can be added to
depends_onto enforce health‑check‑based readiness? - Is there a roadmap for Compose to support conditional start ordering based on service health?
- If not, what is the officially recommended pattern to achieve true readiness without compromising portability?