Docker Community Forums

Share and learn in the Docker community.

Best Practices with Docker Healthcheck

In the documentation there is no indication as to the impact of setting the interval down to a lower number ( for example 1 second). Are there any best practices on what a developer building an image should do for the health check interval ?

Thanks
Chase

depends on your use case.

  • if your health check is expensive, then you shouldn’t do it too often.
  • If your health check is cheap, you can do it a little more often.
  • also if you need to rely on the health of your service much, then you also could invest more time in checking that it is really healthy.
  • if your service is flaky and fails from time to time, then you probably shouldn’t check too often and also given it several retries.

Health checking everytime exec’s a new process. So you shouldn’t do it too often. I think an interval of less than 10 seconds is too small.