1
0
mirror of https://github.com/Tecnativa/docker-socket-proxy synced 2025-06-30 20:32:35 +00:00
docker-socket-proxy/Dockerfile
Austin S. Hemmelgarn 917d26e175
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.
2021-02-09 10:53:52 -05:00

31 lines
557 B
Docker

FROM haproxy:1.9-alpine
EXPOSE 2375
ENV ALLOW_RESTARTS=0 \
AUTH=0 \
BUILD=0 \
COMMIT=0 \
CONFIGS=0 \
CONTAINERS=0 \
DISTRIBUTION=0 \
EVENTS=1 \
EXEC=0 \
IMAGES=0 \
INFO=0 \
LOG_LEVEL=info \
NETWORKS=0 \
NODES=0 \
PING=1 \
PLUGINS=0 \
POST=0 \
SECRETS=0 \
SERVICES=0 \
SESSION=0 \
SWARM=0 \
SYSTEM=0 \
TASKS=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