cloudflared docker health check

Cloudflare’s cloudflared container doesn’t come with a good health check – or so it seems [1]. The functionality is there, though. The tunnel needs to be started with metrics enabled (here: exposed to 127.0.0.1:20241) and the health check needs to call the proper check.

  cloudflared:
    image: cloudflare/cloudflared:latest
    ...
    command: tunnel --metrics 127.0.0.1:20241 run
  healthcheck:
    test: ["CMD","cloudflared","tunnel","--metrics","127.0.0.1:20241","ready"]
    ...

References

[1] https://github.com/cloudflare/cloudflared/issues/1126

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.