Refs: https://docs.docker.com/compose/startup-order/
The problem of waiting for a database (for example) to be ready is really just a subset of a much larger problem of distributed systems. In production, your database could become unavailable or move hosts at any time. Your application needs to be resilient to these types of failures.
Refs: https://docs.docker.com/compose/startup-order/