Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 979 Bytes

README.md

File metadata and controls

27 lines (18 loc) · 979 Bytes

Automatically restart unhealthy docker containers

The systemd unit checks every 30 seconds for unhealthy docker containers and restarts them.

Based on the idea of to https://github.com/willfarrell/docker-autoheal. But simpler and with less features.

Changing the monitoring interval

Create the file /etc/docker-autoheal.env and add a line with autoheal_interval_seconds=30, where 30 is the number of seconds you want as an interval.

Afterwards restart the service with the command systemctl restart docker-autoheal.service.

Install

sudo wget --quiet --output-document /etc/systemd/system/docker-autoheal.service https://raw.githubusercontent.com/ioqy/docker-autoheal-systemd/master/docker-autoheal.service
sudo systemctl daemon-reload
sudo systemctl enable --now docker-autoheal.service

Uninstall

sudo systemctl disable --now docker-autoheal.service
sudo rm /etc/systemd/system/docker-autoheal.service
sudo systemctl daemon-reload