Sign inSign up

prantlf/healthchk

By prantlf

Updated over 2 years ago

Checks health of a HTTP server. Makes a request, prints the result and exits with code.

Image
Networking
Developer tools
0

456

prantlf/healthchk repository overview

Check Health of a HTTP Server

Checks health of a HTTP server. Makes a request, prints the result and exits with zero (success) or non-zero (failure) Suitable for HEALTHCHECK in Dockerfile or healthcheck in docker-compose.yml. Maintained on GitHub.

❯ healthchk https://github.com
status: 200, type: text/html; charset=utf-8, size: 229912 bytes, duration: 2042 ms
  • No dependencies (linked statically)
  • Small size (700 kB)
  • Easy to integrate (from builder Docker image)

Synopsis

An example of Dockerfile:

FROM prantlf/healthchk as healthchk

FROM ...
COPY --from=healthchk /healthchk /
...
HEALTHCHECK --interval=1m CMD /healthchk http://localhost/ping || exit 1

An example of docker-compose.yml:

services:
  service:
    healthcheck:
      test: ["CMD", "/healthcheck", "http://localhost/ping"]
      interval: 1m
    restart: unless-stopped

Configuration

usage: healthchk [option ...] <url>
options:
  -m <method>   HTTP method to use (default: GET)
  -t <seconds>  connection timeout (default: 30 seconds)
  -R            disallow redirects (default: allowed)
  -s            print nothing on success (default: no)
  -v            print the response body too (default: no)

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code.

License

Copyright (C) 2024 Ferdinand Prantl

Licensed under the MIT License.

Tag summary

Content type

Image

Digest

sha256:b380d075e

Size

420.9 kB

Last updated

over 2 years ago

docker pull prantlf/healthchk