app:
build: .
command: is_ready --timeout 10 --addr mysql:3306 -- <run migrations command>
For cases like this, returning 503 every time the database is not ready, is not very convenient. application:
image: image
depends_on:
postgres-db:
condition: service_healthy
However, this is not the case for other databases/services.
As this repository mentions, this is the example using PostgreSQL.
depends_on: postgres-database: condition: service_healthy
healthcheck: test: ["CMD-SHELL", "pg_isready"] interval: 10s timeout: 5s retries: 5
However, PostgreSQL has already a command for this called pg_isready.
How is this going to work for other cases such as MySQL?