Error calling healthcheck: please enable `ping` to use health check

Hello World!

I'm trying to configure the health check for the Traefik:

  1. Traefik Ping Documentation - Traefik
  2. Traefik Services Documentation - Traefik

So, I was able to configure health check for the service, but the to check for the health of my Traefik instances, not so much:

/ # traefik healthcheck
Error calling healthcheck: please enable `ping` to use health check
/ # traefik healthcheck --ping
INFO[0000] Configuration loaded from flags.
Bad healthcheck status: 404 Not Found
/ #

relevant options I used for Traefik to start up:

# grep ping docker-compose.yml
      - "--entryPoints.ping.address=:8082"
      - "--ping=true"
      - "--ping.entryPoint=ping"
#

Please advise.
Thank you in advance)

Hello @alexus,

What are you trying to achieve?

I've used the --ping CLI argument.

And a docker health check.

It correctly gets Traefik's health status.

If you want a more streamlined example, take a look at that:

version: '3.9'

services:
  traefik:
    image: traefik:v2.8
    command:
      - --ping
    healthcheck:
      test: ['CMD', 'traefik', 'healthcheck', '--ping']
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

@tommoulard thank you for taking your time reply to my topic, i do appreciate that :wink:

the last example is very similar to the one I post initially w/ my topic along side with the output from it, and as you see it's not working( and I can't figure out what's wrong...

For me, my example is working as expected:

$ # I'm using the same docker-compose.yml file
$ docker compose up -d
[+] Running 2/2
 ⠿ Network test_default      Created    0.0s
 ⠿ Container test-traefik-1  Started    0.5s
$ docker compose ps
NAME                COMMAND                  SERVICE             STATUS               PORTS
test-traefik-1      "/entrypoint.sh --pi…"   traefik             running (starting)   80/tcp
$ sleep 10s
$ docker compose ps
NAME                COMMAND                  SERVICE             STATUS               PORTS
test-traefik-1      "/entrypoint.sh --pi…"   traefik             running (healthy)    80/tcp
$ docker compose exec traefik traefik healthcheck --ping
INFO[0000] Configuration loaded from flags.             
OK: http://:8080/ping

As you can see, the status goes from starting to healthy, and the CLI tool is working as expected.

hmm, it worked for me ...

# docker compose exec traefik traefik healthcheck --ping
WARN[0000] network default: network.external.name is deprecated in favor of network.name 
INFO[0000] Configuration loaded from flags.             
OK: http://:8080/ping
#

.. once I've made some changes per your example:

# grep ping docker-compose.yml 
        #- "--entryPoints.ping.address=:8082"
      - "--ping=true"
        #- "--ping.entryPoint=ping"
#

I believe the issue is in the URL itself, as my ping was suppose to hit port 8082, however per output it is hitting port 8080 instead..