Open rgl opened 7 months ago
Why does it need to be a binary? Why not an endpoint?
docker (and docker compose) only support healthchecks by calling a binary (e.g. as the healthcheck.test
command displayed above). Have a look at the Dockerfile HEALTHCHECK
instruction documentation.
What's wrong with the example where they append || exit 1
HEALTHCHECK --interval=5m --timeout=3s \
[CMD](https://docs.docker.com/reference/dockerfile/#cmd) curl -f http://localhost/ || exit 1
in order to have a healthcheck in docker compose we need a command that returns a 0 exit code.
we either need a dashboard sub-command (e.g.
dotnet /app/Aspire.Dashboard.dll readyz
) or an http client (e.g.curl
) binary available inside the container.a healthcheck endpoint should also be available, so we can use this in other places, like k8s.
for example, in this hypothetical docker compose file, I'm using
curl
(but a better approach would be to implement something equivalent of this example, but as a dashboard sub-command, e.g.,dotnet /app/Aspire.Dashboard.dll readyz
):