Any easy way to restart containers that are reported unhealthy? I’ve added healthcheck to qbittorrent (it will lose network access if gluetun is restarted/updated) compose and it gets marked as unhealthy, confirmed with docker ps from shell.
Best practice on restarting the unhealthy container?
I’ve tried adding a custom app that basically runs cli command. Love how the Scale compose yaml I paste gets semi mangled
services:
restarter:
cap_drop:
- ALL
command:
- /bin/sh
- '-c'
- >-
while true; do sleep 60; docker ps -q -f health=unhealthy | xargs
--no-run-if-empty docker restart; done
image: docker:cli
network_mode: none
restart: unless-stopped
volumes:
- /var/run/docker.sock:/var/run/docker.sock`Preformatted text`
But that just crashes the unhealthy pod.
Guess the alternative would be to run a cron job for:
docker ps -q -f health=unhealthy | xargs --no-run-if-empty docker restart