Healthchecks and Swarm

I was pleased but surprised to discover that HEALTHCHECKs are actually used by swarm in a way that they aren’t by docker-compose.

More details here:

Is this actually in the documentation anywhere?

Q

Hi :slight_smile:

Yes its correct that its a docker service feature, to actually benefit from healthchecks.
But there is also a solution to it, you can use something like:
https://hub.docker.com/r/willfarrell/autoheal/

Thanks Martin, that’s useful, I guess, if you need to get docker-compose to do the same thing as swarm re health checks.

Else, you can set a restart policy in docker-compose for containers, so if they exit because if main-program dies.
it will restart