Skip to content

Instantly share code, notes, and snippets.

@shinebayar-g
Forked from tareksamni/docker-compose.yml
Created October 21, 2020 23:11
Show Gist options
  • Save shinebayar-g/1bf9e795be1641bf0ecda125fb214084 to your computer and use it in GitHub Desktop.
Save shinebayar-g/1bf9e795be1641bf0ecda125fb214084 to your computer and use it in GitHub Desktop.
Example of using docker-compose health checks
version: '2.1'
services:
db:
image: bla_bla:1234/mysql:5.6
environment:
- MYSQL_ROOT_PASSWORD=XXXX
- MYSQL_DATABASE=bla_bla_dev
- MYSQL_USER=XXXX
- MYSQL_PASSWORD=XXXX
ports:
- 3306
healthcheck:
test: "/etc/init.d/mysql status"
interval: 1s
retries: 120
app:
build: .
command: /bin/bash -lc "whoami"
volumes:
- .:/app
environment:
- DB_HOST=db
- DB_NAME=bla_bla_dev
- DB_USERNAME=XXXX
- DB_PASSWORD=XXXX
links:
- db
depends_on:
db:
condition: service_healthy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment