Skip to content

Instantly share code, notes, and snippets.

@HorlogeSkynet
Created August 21, 2018 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save HorlogeSkynet/26d2664c265fc0dc54f907e456962148 to your computer and use it in GitHub Desktop.
Save HorlogeSkynet/26d2664c265fc0dc54f907e456962148 to your computer and use it in GitHub Desktop.
How to start application container only once MongoDB has finished warming up, running with Docker
version: '2.3'
services:
application:
build: .
depends_on:
database:
condition: service_healthy
database:
image: mongo:latest
restart: unless-stopped
healthcheck:
test: mongo --quiet --eval "db.runCommand('ping').ok"
interval: 30s
timeout: 5s
retries: 3
start_period: 15s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment