Skip to content

Simplest HTTP health check for Docker containers

License

Notifications You must be signed in to change notification settings

mymmrac/mini-health

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Health

CI Docker Pulls

Simplest HTTP health check for scratch docker images

Usage

In your Dockerfile:

COPY --from=mymmrac/mini-health:latest /mini-health /mini-health
HEALTHCHECK CMD ["/mini-health", "https://example.org"]

Optionally copy ca-certificates if you don't have them already:

COPY --from=mymmrac/mini-health:latest \
    /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt

Options

Usage mini-health [OPTIONS] URL

Option Description
-c int Smallest HTTP status code that is considered as an error (default: 400 bad request)
-d string Data passed as body of request
-e string Name of environment variable used as base URL
-m string HTTP method used for request (default: GET)
-q Quiet output (print only errors)

Example

HEALTHCHECK CMD ["/mini-health", "-e", "BASE_URL", "-c", "500", "/health"]

In this example GET request to URL $BASE_URL/health with no body will be made, HTTP status codes greater than 500 will be reported as errors.

Install manually

go install github.com/mymmrac/mini-health@latest