depends_on & health conditions
Wait for a useful dependency state
Lesson 14 of 20 · 12 min · Module 5: Readiness and runtime boundaries
Startup order and application readiness are different promises.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Name the readiness dependency
- Provide the corresponding probe
The idea
Compose describes services and their relationships as YAML mappings and sequences. Read the whole service graph, including access and storage boundaries.
01Name the readiness dependency
A started container may still be initializing. A service_healthy dependency uses the dependency healthcheck rather than assuming that process startup means readiness.
02Provide the corresponding probe
The health condition needs an actual healthcheck definition on cache. The lab rejects healthy dependencies whose target has no probe.
03Retain application resilience
Startup gating does not guarantee a dependency will stay available. Real clients still need appropriate timeouts and recovery behavior during operation.
Your turn
What the checks look for
- Waits for a healthy cache
- Declares a Redis probe
Take this with you
Use a meaningful readiness condition while keeping clients resilient.
Go a little further
Create a dependency cycle and read the validation error.