From 6938580513f7155a829291d4aed0435fc411def7 Mon Sep 17 00:00:00 2001 From: Peter Goodhall Date: Thu, 17 Jul 2025 17:18:56 +0100 Subject: [PATCH] Update docker-compose healthcheck and restart policies Replaces the db service healthcheck command with a custom script and adjusts its parameters for longer timeouts and retries. Also changes the app service's depends_on syntax and adds a restart policy to improve container reliability. --- docker-compose.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index b26b53d2..99ef975a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -14,10 +14,10 @@ services: - ./:/var/www/html:rw command: ["./script.sh"] depends_on: - db: - condition: service_healthy + - db networks: - mynet + restart: on-failure db: build: @@ -30,11 +30,11 @@ services: networks: - mynet healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost"] - timeout: 20s - retries: 10 - interval: 10s - start_period: 30s + test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"] + timeout: 30s + retries: 20 + interval: 15s + start_period: 60s volumes: db_data: {}