Docker compose healthcheck #12928
|
Evening, Im trying to get a Docker healthcheck up and running in Docker Compose. In my ...
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost:9091/api/state || exit 1"]
interval: 30s
timeout: 3s
retries: 3
start_period: 5s
...That results in unhealthy status and zero state health information though: $ docker compose ps
NAME IMAGE COMMAND SERVICE CREATED STATUS PORTS
Authelia docker.io/authelia/authelia:4.39.20 "/app/entrypoint.sh" authelia 2 minutes ago Up 2 minutes (unhealthy) 9091/tcp
$ docker inspect Authelia --format "{{ (index (.State.Health.Log) 0).Output }}"
{NOTHING DISPLAYED HERE}I have poked and proded around in the code, docs, discussions and issues for a cluepon and come up with none. Unsure what im doing wrong, if anything or maybe its just not supported? |
Replies: 1 comment 1 reply
|
Two separate things. The The bigger thing is that you don't need the stanza. The image already declares a healthcheck: and Authelia rewrites The one case where it does nothing is If you want your own anyway: |
Two separate things.
The
testis in exec form, so there's no shell to interpret||. Docker hands wget one argument —http://localhost:9091/api/state || exit 1, spaces and all — and wget takes the whole string as the URL, so it fails every time.--quietis why the log looks empty: you've told wget not to print anything, so there's nothing for docker to capture.The bigger thing is that you don't need the stanza. The image already declares a healthcheck:
and Authelia rewrites
/app/.healthcheck.envduring startup with the scheme, host, port and path read back off your ownserverconfig (writeHealthCheckEnvConfig…