HUB
Sign inSign up

subtlepseudonym/healthcheck

By subtlepseudonym

•Updated about 4 years ago

A small-as-possible binary for performing docker health checks against an HTTP endpoint

Image
0

358

subtlepseudonym/healthcheck repository overview

⁠Healthcheck

docker_size

This project is intended as a lightweight binary that can be included in a docker image for health checks. The latest image size is included in the badge above.

It expects two arguments, a host address and an HTTP endpoint.

healthcheck localhost:80 /ok

Healthcheck makes a GET request to the provided host and endpoint and exits with code 0 if it receives a response code of 200 OK. On any other error, it exits with code 1.

⁠Examples

nginx.conf

http {
  server {
    listen 8080;

    location /ok {
      return 200;
    }
  }
}

Dockerfile

FROM nginx:latest
COPY nginx.conf /etc/nginx/nginx.cof
COPY --from=subtlespeudonym/healthcheck:latest /healthcheck /healthcheck

EXPOSE 8080
HEALTHCHECK CMD healthcheck localhost:8080 /ok
⁠Building from source

To get the smallest, static binary and the same one included in the docker image:

make release

There are, however, a few other options to building this project:

# best performance, large binary, dynamically linked
cargo build

# smallest binary, dynamically linked
cargo build --release

# statically linked
cargo build --release --target x86_64-unknown-linux-musl

Tag summary

Content type

Image

Digest

sha256:bbdb9924f…

Size

47.2 kB

Last updated

about 4 years ago

docker pull subtlepseudonym/healthcheck