From 85ae96d12a253b80cdcf8bee23f6f6f85fd6b902 Mon Sep 17 00:00:00 2001 From: Alvaro Carpio Date: Wed, 12 May 2021 07:57:25 -0500 Subject: [PATCH] Added healthcheck to MySql db Signed-off-by: Alvarfo Carpio alvanxp@outlook.com Signed-off-by: Alvaro Carpio --- nginx-golang-mysql/docker-compose.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/nginx-golang-mysql/docker-compose.yaml b/nginx-golang-mysql/docker-compose.yaml index 11f4ffe..cb2999f 100644 --- a/nginx-golang-mysql/docker-compose.yaml +++ b/nginx-golang-mysql/docker-compose.yaml @@ -4,12 +4,18 @@ services: build: backend secrets: - db-password - depends_on: - - db + depends_on: + db: + condition: service_healthy db: image: mysql:8.0.19 command: '--default-authentication-plugin=mysql_native_password' restart: always + healthcheck: + test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"] + interval: 3s + retries: 5 + start_period: 30s secrets: - db-password volumes: