Skip to content

Instantly share code, notes, and snippets.

@Kline-
Created June 24, 2024 20:08
Show Gist options
  • Save Kline-/c48c9f61fded798404fdaf97d0448a8b to your computer and use it in GitHub Desktop.
Save Kline-/c48c9f61fded798404fdaf97d0448a8b to your computer and use it in GitHub Desktop.
Restart unhealthy docker containers.
[Unit]
Description=docker-hc
Wants=docker-hc.timer
[Service]
Type=oneshot
ExecStart=/usr/local/sbin/docker-hc.sh
User=root
Group=root
#!/bin/bash
docker ps -q -f health=unhealthy | xargs -r docker restart
[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