Docker Compose Wait til dependency container is fully up before launching

后端 未结 2 633
南笙
南笙 2021-02-14 09:55

I\'m working with a docker service using docker-compose, and I have a service that depends on anther.

I\'ve used the depends_on key, but the service with t

2条回答
  •  孤独总比滥情好
    2021-02-14 10:24

    You are probably looking for docker compose healthcheck

    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U postgres"]
      interval: 10s
      timeout: 5s
      retries: 5
    

    There is a good reference here as well:
    https://github.com/peter-evans/docker-compose-healthcheck

提交回复
热议问题