Add a minimalistic health check to the Docker image.

This adds a minimalistic check to the Docker image that verifies that
HAProxy is actually listening on port 2375, marking the image as
unhealthy if the check fails. This, in turn, allows container
orchestration tools to notify an administrator that something is wrong
or even restart the container automatically.

This utilizes the Busybox implementation of `netcat`, which is already
included in the image itself, and thus has functionally zero impact on
image size. The check interval is set for once every 60 seconds, which
is reasonably normal for small services like this.
pull/43/head
Austin S. Hemmelgarn 3 years ago
parent 6dce4aab3c
commit 917d26e175
No known key found for this signature in database
GPG Key ID: 4138B50D9B8289C6

@ -27,3 +27,4 @@ ENV ALLOW_RESTARTS=0 \
VERSION=1 \
VOLUMES=0
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg
HEALTHCHECK --interval=1m --timeout=10s CMD nc -z 127.0.0.1 2375 || exit 1

Loading…
Cancel
Save