Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recognition of "deunhealth.restart.on.unhealthy" #48

Open
pirh2o opened this issue Jun 25, 2022 · 6 comments
Open

Recognition of "deunhealth.restart.on.unhealthy" #48

pirh2o opened this issue Jun 25, 2022 · 6 comments

Comments

@pirh2o
Copy link

pirh2o commented Jun 25, 2022

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.

@qdm12
Copy link
Owner

qdm12 commented Jun 26, 2022

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

@pirh2o
Copy link
Author

pirh2o commented Jun 27, 2022

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
Copy link
Author

pirh2o commented Jul 14, 2022

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

@Freekers
Copy link

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.

@teodorescuserban
Copy link

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?

@martindmtrv
Copy link

Yeah I just had this issue and changing to the string seemed to fix it.

Though it is not obvious why this happens, when running docker container inspect on the container before and after I see the same output for both. Maybe the api that is used to pull the docker output knows the difference

with boolean true in the label
"deunhealth.restart.on.unhealthy": "true",

With string "true"
"deunhealth.restart.on.unhealthy": "true",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants