The healthcheck will report as healthy if the HTTP request is successful and the status of the HTTP requests is not in the range of 400-599. This can be used to add healthchecks to containers that don't have access to the usual methods of health checking.
Take the following as a simple example of using the healthcheck in a distroless image:
# Build healthcheck
FROM rust:latest-bookworm AS healthcheck-builder
RUN cargo install simple-web-healthcheck
# Rest of your build...
FROM gcr.io/distroless/cc-debian12
COPY /usr/local/cargo/bin/simple-web-healthcheck /healthcheck
# Copy your app here
HEALTHCHECK CMD ["/healthcheck", "http://127.0.0.1:8080"]
The simple-web-healthcheck binary currently has a size of around 1.6 MB