Docker container healtcheck

I would like to check the health of the influxdb container so I added the following to my docker-compose file

      test: ["CMD", "curl", "influxdb:8086/api/v2/ping"]
      interval: 1m
      timeout: 10s
      retries: 5

It seems to work but influx logs an unauthorised connection every minute which when I tested confirmed that it is because of the health check attempt to “ping” the service.
Is there a way to do this without a token? It seems overkill to have to create and use a token to check if the application is running.

Is there another way to do this without a token?

Thank you

You might be able to do what you want if you can scrape this url from inside the container , believe this url doesn’t require any authentication (but apologies if I’m wrong) because it is listening on localhost. It should be enough to test the http return code is in the 2xx range to test for success


More info here too:

If it does neeed authentication too, here’s the details for how to do that

Let us know how you get on, what your final solution ends up as.

This is what I’m using in my docker-compose and it seems to be working:

    test: "curl -f http://localhost:8086/ping"
    interval: 5s
    timeout: 10s
    retries: 5