Add healthcheck to the mysql service
- a start_period of 30s + 15s (interval * retries) should be long enough for mysql to initialize Signed-off-by: Friedrich Greiner <greinerfriedrich@gmail.com>
This commit is contained in:
parent
0fa30766c2
commit
bbbf2b44d8
@ -11,13 +11,19 @@ services:
|
|||||||
- react-spring
|
- react-spring
|
||||||
- spring-mysql
|
- spring-mysql
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
db:
|
||||||
|
condition: service_healthy
|
||||||
db:
|
db:
|
||||||
environment:
|
environment:
|
||||||
MYSQL_DATABASE: example
|
MYSQL_DATABASE: example
|
||||||
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
|
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
|
||||||
image: mysql:8.0.19
|
image: mysql:8.0.19
|
||||||
restart: always
|
restart: always
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
|
||||||
|
interval: 3s
|
||||||
|
retries: 5
|
||||||
|
start_period: 30s
|
||||||
secrets:
|
secrets:
|
||||||
- db-password
|
- db-password
|
||||||
volumes:
|
volumes:
|
||||||
|
Loading…
Reference in New Issue
Block a user