Created
June 24, 2024 20:08
-
-
Save Kline-/c48c9f61fded798404fdaf97d0448a8b to your computer and use it in GitHub Desktop.
Restart unhealthy docker containers.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=docker-hc | |
Wants=docker-hc.timer | |
[Service] | |
Type=oneshot | |
ExecStart=/usr/local/sbin/docker-hc.sh | |
User=root | |
Group=root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
docker ps -q -f health=unhealthy | xargs -r docker restart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=docker-hc | |
[Timer] | |
Unit=docker-hc.service | |
OnCalendar=Hourly | |
Persistent=true | |
[Install] | |
WantedBy=timers.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment