What is HEALTHCHECK really used for when running Docker in swarm mode?

by sbrattla   Last Updated January 05, 2018 23:00 PM

I'm having a hard time figuring out what HEALTHCHECK really is used for when running Docker in swarm mode.

One place suggests that Docker will restart a task which is considered unhealthy. Another place explains that Docker will stop sending traffic to tasks that are unhealthy. The Docker documentation itself only explains what the HEALTHCHECK directive is, and how to configure it. It makes no attempt to explain what happens when a task goes unhealthy.

In other words, I'm struggling to find a clear and trustworthy explanation of what HEALTCHECK really does.

Furthermore, looking at the Docker REST API, this particular piece of data (is a task healthy or not) is not even exposed for tasks (it is exposed for containers though). This makes it hard to use this metric for monitoring a Docker Swarm, so it doesn't seem to me that this is the primary purpose of the metric either.

What really happens when a task becomes unhealthy when running Docker in swarm mode?

Related Questions

Docker Issue - exit status 34

Updated January 25, 2018 13:00 PM

docker stack network issue

Updated September 11, 2017 12:00 PM

Browser services' container in Docker Swarm mode

Updated April 26, 2017 08:00 AM