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

Support Docker health checks #709

Open
jmorino opened this issue Nov 6, 2020 · 2 comments
Open

Support Docker health checks #709

jmorino opened this issue Nov 6, 2020 · 2 comments

Comments

@jmorino
Copy link

jmorino commented Nov 6, 2020

Hi, is there a way to integrate with Docker health checks ?

@buchdag buchdag added the kind/feature-request Issue requesting a new feature label Nov 6, 2020
@buchdag
Copy link
Member

buchdag commented Nov 6, 2020

At the moment no, but contributions are welcome 👍

@buchdag buchdag removed the kind/feature-request Issue requesting a new feature label Jan 19, 2025
@stephane-klein
Copy link

Here is my implementation of healtcheck for nginx-proxy and acme-companion.

I'm not sure it's very robust 🤔.

Still, it has the advantage of allowing me to use the --wait option in docker-compose up -d --remove-orphans --wait.

# docker-compose.yml
services:
  nginx-proxy:
    image: nginxproxy/nginx-proxy:1.6.4
    container_name: nginx-proxy
    restart: unless-stopped
    network_mode: "host"
    volumes:
      - ./vhost.d/:/etc/nginx/vhost.d:rw
      - ./htpasswd:/etc/nginx/htpasswd:ro
      - html:/usr/share/nginx/html
      - certs:/etc/nginx/certs:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    healthcheck:
      test: ["CMD-SHELL", "nginx -t && kill -0 $$(cat /var/run/nginx.pid)"]
      interval: 10s
      timeout: 2s
      retries: 3

  acme-companion:
    image: nginxproxy/acme-companion:2.5.1
    restart: unless-stopped
    volumes_from:
      - nginx-proxy
    depends_on:
      - "nginx-proxy"
    environment:
      DEFAULT_EMAIL: [email protected]
    volumes:
      - certs:/etc/nginx/certs:rw
      - acme:/etc/acme.sh
      - /var/run/docker.sock:/var/run/docker.sock:ro
    healthcheck:
      test: ["CMD-SHELL", "ps aux | grep -v grep | grep -q '/bin/bash /app/start.sh'"]
      interval: 30s
      timeout: 3s
      retries: 3
      start_period: 10s

volumes:
  html:
  certs:
  acme:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants