qdm12 / deunhealth

Binary program to restart unhealthy Docker containers
MIT License
124 stars 8 forks source link

Feature request: Time for container in unhealthy state #14

Open SAOPP opened 3 years ago

SAOPP commented 3 years ago

Hi!

Thanks for tool! As I understood the deunhealth is not cheked how long monitored container is an unheathy state, and immeadetly will start try to restart it. If I right, I think will be greate to add some addition label for containers, where will we can set specify time for container in unhealthy state for action from deunhealth container.

'coz if monitored container is unhealty state, deunhealth start trying to restart it immeadely, and I for example I have some container with set heathy state over 1 minute, it's not really good.

Any comments? :) Thanks.

qdm12 commented 3 years ago

Yes that's a good idea, thanks!

In the meantime, you could change the healthcheck settings of your container (see docker run healthcheck docs) so it would only be as unhealthy after N tries with a fixed period. That would effectively do almost what you want.

SAOPP commented 3 years ago

In the meantime, you could change the healthcheck settings of your container (see docker run healthcheck docs) so it would only be as unhealthy after N tries with a fixed period. That would effectively do almost what you want. Hm, well, when I checked this, I mean checked the logs of deunhealth, I saw that deunhealth start to restarting my samba container, but I just updated my compose before and samba just started and waith for first heathcheck run... but as I understood the deunhealth container is run it's own logic -> container unheathy -> restart it!

Maybe I'm wrong, 'coz samba is working at old x86 slim mini server, and I need more time than 15s (~35s) for execute heathcheck in this container.

So, will be dope, if we can have maybe one main label, with set time, or maybe additional label for containers with unique scheduled time for unhealthy state.

DataBitz commented 2 years ago

Just setup deunhealth and hit the same problem. I have a container which health takes some time to go healthy after starting and deunhealth restarts it over and over. Never enough time for it to actually start.

qdm12 commented 2 years ago

time to go healthy after starting and deunhealth restarts it over and over

It most likely goes unhealthy then (although for a split millisecond and then gets restarted). Deunhealth doesn't restart containers with their health in starting state.

imbehind commented 1 year ago

In the meantime, you could change the healthcheck settings of your container (see docker run healthcheck docs) so it would only be as unhealthy after N tries with a fixed period.

How to do that with Gluetun? It does the healthcheck automatically.