Compose stack and readiness
Worked example
This is an offline lesson. Data are fictional and Docker commands are unexecuted. Any optional execution requires an authorized disposable VM, a verified context, synthetic data, restricted access and no external transmission. Do not collect secrets or private output. Before any separately authorized Docker query, verify the effective endpoint and builder (including environment overrides), not just the context name. Use only disposable lab resources; a failed check is a stop condition, not permission to retry against a different host.
Reference compose.yaml (staged):api: image bytemind-notes:lab-v1; back; notes-data; write_tokenproxy: same image, proxy command; front + backproxy depends_on api condition: service_healthyAPI health: database query; proxy health: backend response.No host port mapping. Probe proxy from inside its container.Use project name bmnotes-lab only after checking it is unused.Use the same tested artifact for both entry commands. The proxy uses the Compose service name api on the back network, not localhost. Both internal networks restrict normal external routing; they are not a guarantee against a compromised host or application. Health checks verify an application request, not simply that a process exists. The health dependency controls startup ordering, not continuous recovery or automated failover. If the backend disappears, the proxy returns a bounded failure response, and its own readiness fails. Record service status, sanitized logs and HTTP response separately. Stop and investigate rather than adding arbitrary sleeps. Use explicit -f compose.yaml and -p bmnotes-lab from the reviewed reference directory, with environment overrides reviewed, for every separately authorized Compose action. Verify the rendered configuration and image ID for both services. The healthchecks currently verify HTTP success; separately assert ready=true and expected item data. Startup dependency does not continuously gate traffic.
Common mistake
Publishing a host port is unnecessary for an in-container probe. Do not expose the API just to debug service discovery.
Manual practice
Fill in the starter Compose network and health dependency placeholders. Trace an HTTP request and explain the expected response when api is unavailable.
Worksheet: lab-fixtures/docker-professional-capstone/03-compose-stack/scenario.txt. Project: lab-fixtures/docker-professional-capstone/project/.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Compose stack and readiness — Knowledge check
Interpret capstone evidence and make a safe operational decision.
What hostname does the proxy use to reach its backend?
What does service_healthy govern here?
Where is the default HTTP probe performed?