Docker autoheal : restart auto d'un Docker en souffrance, tout seul, dans son coin, mal-aimé

Docker 7 avr. 2019

Docker, c’est beau. Docker, c’est simple. Docker, c’est pratique. Docker, c’est rapide. Docker, ça me rend fainéant (et j’assume).

A tel point que je ne veux même plus aller regarder de temps en temps ce qu’il se passe et si ça cafouille. Willfarrel a créé un outil bien pratique : autoheal. Basé sur la santé (“health“) des containers Dockers lancés, il va automatiquement relancer ceux qui sont “unhealthy”.

Docker => https://hub.docker.com/r/willfarrell/autoheal

Exemple pour surveiller l’ensemble de vos containers

docker run -d \
--name autoheal \
--restart=always \
-e AUTOHEAL_CONTAINER_LABEL=all \
-v /var/run/docker.sock:/var/run/docker.sock \
willfarrell/autoheal

Ce qui peut donner ceci

01-04-2019 22:03:21 Container /nginx-proxy-manager (282b1dc8587c) found to be unhealthy - Restarting container now with 10s timeout
01-04-2019 22:03:21 Restarting container 282b1dc8587c failed
01-04-2019 22:03:56 Container /nginx-proxy-manager (282b1dc8587c) found to be unhealthy - Restarting container now with 10s timeout
Monitoring containers for unhealthy status in 0 second(s)

Mots clés