deunhealth icon indicating copy to clipboard operation
deunhealth copied to clipboard

Recognition of "deunhealth.restart.on.unhealthy"

Open pirh2o opened this issue 2 years ago • 5 comments

I've running the latest version of deunhelath in a docker container through docker-compose stack. The version of docker and compose are the latest as well. In the stacks of the containers that I want to restart when becoming unhealthy, I've added the label as follows:

labels:
  deunhealth.restart.on.unhealthy: true

Despite the containers work fine and labels have been added correctly, deunhealth does not seem to recognise the labels, being the deunhealth's log as follows:

2022/06/25 14:00:23 INFO healthcheck: listening on 127.0.0.1:9999
2022/06/25 14:00:23 INFO Monitoring 0 containers to restart when becoming unhealthy
2022/06/25 14:00:23 INFO New labeled containers will be automatically detected

I don't know if I'm doing something wrong.

Thanks in advance.

pirh2o avatar Jun 25 '22 12:06 pirh2o

Can you share your deunhealth full logs and docker-compose.yml please?

qdm12 avatar Jun 26 '22 20:06 qdm12

All my logs are these:

========================================

============== deunhealth ==============

=========== Made with ❤️ by ============ =========== github.com/qdm12 ===========

========================================

Running version latest built on 2021-11-28T12:51:56Z (commit 6f26ebf)

🔧 Need help? https://github.com/qdm12/deunhealth/discussions/new 🐛 Bug? https://github.com/qdm12/deunhealth/issues/new ✨ New feature? https://github.com/qdm12/deunhealth/issues/new ☕ Discussion? https://github.com/qdm12/deunhealth/discussions/new 💻 Email? [email protected] 💰 Help me? https://www.paypal.me/qmcgaw https://github.com/sponsors/qdm12 2022/06/27 18:34:18 INFO healthcheck: listening on 127.0.0.1:9999 2022/06/27 18:34:18 INFO Monitoring 0 containers to restart when becoming unhealthy 2022/06/27 18:34:18 INFO New labeled containers will be automatically detected

And my docker-compose is:

version: "3.7" services: deunhealth: container_name: deunhealth image: qmcgaw/deunhealth volumes: - '/var/run/docker.sock:/var/run/docker.sock' environment: - LOG_LEVEL=info - HEALTH_SERVER_ADDRESS=127.0.0.1:9999 - TZ=Europe/Madrid network_mode: "none" restart: always

Thanks again. Regards.

pirh2o avatar Jun 27 '22 17:06 pirh2o

When the label "deunhealth.restart.on.unhealthy" is created manually, it works. The problem is doing one by one for each container.

pirh2o avatar Jul 14 '22 16:07 pirh2o

I have exactly the same issue on Raspberry Pi 3b (ARM_V7). Does not work when labels are created using docker-compose, have to add them manually.

Freekers avatar Aug 22 '22 07:08 Freekers

Make sure you are using one of these two modes to add the label in the docker-compose:

...
    labels:
      deunhealth.restart.on.unhealthy: "true"
...

or

...
    labels:
      - deunhealth.restart.on.unhealthy=true
...

Do not use this way:

...
    labels:
      deunhealth.restart.on.unhealthy: true
...

because docker-compose would replace the boolean true with "True" and that would not work it seems.

Perhaps deunhealth could check for all variants?

teodorescuserban avatar Oct 19 '22 07:10 teodorescuserban