Skip to content

Commit e1a82ab

Browse files
committed
Wait for Mongo health in Compose
1 parent db58a08 commit e1a82ab

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

docker-compose.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ services:
88
image: whoi/ndsf-sealog-server
99
restart: unless-stopped
1010
depends_on:
11-
- mongo
11+
mongo:
12+
condition: service_healthy
1213

1314
environment:
1415
# Change this value to something random
@@ -31,6 +32,12 @@ services:
3132
mongo:
3233
image: mongo:4
3334
restart: unless-stopped
35+
healthcheck:
36+
test: ["CMD", "mongo", "--quiet", "--eval", "db.adminCommand('ping').ok"]
37+
interval: 2s
38+
timeout: 5s
39+
retries: 30
40+
start_period: 5s
3441
volumes:
3542
- database:/data/db
3643

0 commit comments

Comments
 (0)