Built-in Docker Healthcheck
firecow opened this issue · comments
Describe the feature you'd like
I would like the docker image to contain curl or wget so it's possible to create a docker healthcheck that docker-compose or docker swarm can use.
It would be nice the healthchecking is just native to the cloudflare/cloudflared image like so.
FROM cloudflare/cloudflared:2023.10.0 as cloudflared
FROM alpine:3.18.4
COPY --from=cloudflared /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=cloudflared /usr/local/bin/cloudflared /usr/local/bin
ENV TUNNEL_METRICS="localhost:2000"
HEALTHCHECK --interval=5s --retries=6 --timeout=3s CMD wget -q ${TUNNEL_METRICS}/ready -O -
If building from alpine is something you don't want to do, then provide a cloudflare tunnel health
command that can be used like so
HEALTHCHECK --interval=5s --retries=6 --timeout=3s CMD cloudflare tunnel health --ready-endpoint localhost:2000/ready
or like so
services:
cloudflared:
image: cloudflare/cloudflared
environment:
TUNNEL_METRICS: "localhost:2000"
healthcheck:
command: cloudflared tunnel health --ready-endpoint ${TUNNEL_METRICS}/ready
interval: 5s
retries: 6
timeout: 3s
Describe alternatives you've considered
Build my own image built on-top of the cloudflare/cloudflared image or use third-party images built on top of cloudflare's
I second this. Would be very helpful when using auto heal.
Using the following Dockerfile could be working:
FROM tarampampam/curl as curl
FROM erisamoe/cloudflared
COPY --from=curl /bin/curl /bin/
Credits:
https://github.com/sidevesh/cloudflared-with-health-check