caddyserver / caddy-docker

Source for the official Caddy v2 Docker Image
https://hub.docker.com/_/caddy
Apache License 2.0
398 stars 73 forks source link

healthcheck always shows unhealthy #331

Closed tareny closed 6 months ago

tareny commented 6 months ago

I configure healthcheck like this in dockercompose, but docker keeps showing that the caddy container is in an unhealthy state. How should I modify it?

    healthcheck:
      test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:2019/metrics", "||", "exit", "1"]
      start_period: 60s
      interval: 10s
      timeout: 5s
      retries: 3
francislavoie commented 6 months ago

Why did you close this? Did you figure out your problem? What was it?

tareny commented 6 months ago

Why did you close this? Did you figure out your problem? What was it?

Yes, the first code is what the new Bing told me is "wget --no-verbose --tries=1 --spider http://localhost:2019/metrics || exit 1", in fact "wget --no-verbose --tries=1 --spider http://localhost:2019/metrics" is fine