Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add healthcheck and depends_on #19

Closed
qunabu opened this issue Jun 24, 2022 · 1 comment · Fixed by #20
Closed

add healthcheck and depends_on #19

qunabu opened this issue Jun 24, 2022 · 1 comment · Fixed by #20
Assignees

Comments

@qunabu
Copy link
Contributor

qunabu commented Jun 24, 2022

wait for postgres to be fully working before launching main app docker image

example

services:
  db:
    image: postgres
    environment:
      - POSTGRES_USER=king
      - POSTGRES_DB=kong
      - POSTGRES_HOST_AUTH_METHOD=trust
    healthcheck:
      test: pg_isready -U postgres

  web:
    image: alpine
    depends_on: 
      db:
        condition: service_healthy
@qunabu
Copy link
Contributor Author

qunabu commented Jul 8, 2022

https://docs.docker.com/compose/startup-order/

depends_on does not wait for db and redis to be “ready” before starting web - only until they have been started. If you need to wait for a service to be ready, see Controlling startup order for more on this problem and strategies for solving it.
The depends_on option is ignored when deploying a stack in swarm mode with a version 3 Compose file.

@qunabu qunabu reopened this Jul 8, 2022
@qunabu qunabu closed this as completed Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant