Open vdrover opened 9 months ago
Thank you for sharing your yaml
. It helps me understand what scenarios to prioritize.
I'm actively working on this project so stay tuned. I'm aiming to have something that works in your case by this weekend and I want to include recovery of unhealthy containers (à la deunhealth
/autoheal
).
My first implementation was too naive and I didn't consider that other services (namely watchtower
) could have removed containers while restarter
was trying to restart them. While addressing this problem I realized that the use of network_mode
requires a little bit more work. interestingly, I found out that watchtower
has recently introduced support for network_mode
(containrrr/watchtower/pull/1429) but I believe that their enhancement will work on updates, not on unhealthy services. I'll just have to be sure that my code plays nicely with that feature.
I have greatly simplified my initial plans and the latest version I pushed will only recreate containers if they have been labelled with restarter.depends_on_service
, as soon as they become unhealthy. In your case, service speedtest-tracker
will need:
labels:
restarter.depends_on_service: gluetun
You'll also need to disable autoheal
for the specific container.
The docker-py API didn't make it easy to recreate a container and I had to map all configuration settings one by one. I believe I covered almost all of them and I tested your speedtest-tracker
but for more complex containers you'll have to try. A docker inspect
before and after the container being recreated should tell which settings I didn't get right.
I'm using Gluetun as my VPN client. My services that reply on Gluetun use
network mode
rather thandepends on
. Below I am showing a single service (Speedtest tracker) as an example.Can I add docker-restarter to my stack in this scenario? Please advise any changes needed for me to test. Also, would this replace the need for autoheal?