I am trying to make sure that my app container does not run migrations / start until the db container is started and READY TO accept connections.
So I decided to use
Since v3 condition: service_healthy is no longer available.
The idea is that the developer should implement mechanism for crash recovery within the app itself.
However for simple use cases a simple way to resolve this issue is to use restart option.
If mysql service status causes your application to exited with code 1 you can use one of restart policy options available. eg, on-failure
version: "3"
services:
app:
...
depends_on:
- db:
restart: on-failure