Created
April 13, 2020 16:59
-
-
Save grizmio/ed689558a1fa8fd879d8e70c69da4c2f to your computer and use it in GitHub Desktop.
Example to wait for postgres container before start another container using docker-compose.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Credits to: https://github.com/peter-evans | |
# Extracted from: https://github.com/peter-evans/docker-compose-healthcheck/blob/master/docker-compose.yml | |
# TL;DR; | |
version: "2.2" | |
services: | |
foo: | |
image: an_image:tag | |
networks: | |
- mean | |
depends_on: | |
postgres: | |
condition: service_healthy | |
postgres: | |
image: postgres:10.1 | |
mem_limit: 1500m | |
environment: | |
- POSTGRES_PASSWORD=apass | |
- POSTGRES_USER=auser | |
- POSTGRES_DB=adb | |
networks: | |
- mean | |
healthcheck: | |
test: ["CMD-SHELL", "pg_isready -U postgres"] | |
interval: 20s | |
timeout: 5s | |
retries: 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment