2024/03/21
that depends_on: [ service ] waits for service to be started, not for service to be healthy.
On startup, Compose does not wait until a container is “ready”, only until it’s running.
The solution for detecting the ready state of a service is to use the condition attribute with one of the following options:
- service_started
- service_healthy. This specifies that a dependency is expected to be “healthy”, which is defined with healthcheck, before starting a dependent service.
- service_completed_successfully. This specifies that a dependency is expected to run to successful completion before starting a dependent service.