Hey, I’ve put together a little demo showing of the Docker HEALTHCHECK
functionality, which can help keep your services running fine. Docker can periodically run a command in your container and depending on the command’s results restart it.
In this demo, a small web service is implemented, which has a state endpoint. Ona a given trigger, it will go into a bad state, and starts to return 503
errors on that endpoint. The healthcheck picks that up, and restarts the container.
Of course this is a very simple demo, and there are many different ways to check health (presence or absence of files, simple results of a complex script packaged with the service, network pings, etc…)
Hope this will help to make your services work even more reliably!