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

"true" must be quoted in docker compose: documentation issue? #110

Open
reinout opened this issue Aug 28, 2023 · 2 comments
Open

"true" must be quoted in docker compose: documentation issue? #110

reinout opened this issue Aug 28, 2023 · 2 comments

Comments

@reinout
Copy link

reinout commented Aug 28, 2023

I have a mix of services with only some of them having a health check. So I configured autoheal like this in my docker-compose.yml:

autoheal:
  image: willfarrell/autoheal:1.1.0
  tty: true
  restart: unless-stopped
  environment:
    - AUTOHEAL_CONTAINER_LABEL=autoheal
  volumes:
    - /var/run/docker.sock:/var/run/docker.sock

And the services with healthcheck got the label:

geoserver:
  image: ...
  labels:
    autoheal: true

Autoheal didn't seem to be working for me. No logs. Well, the instances that could need to be autohealed rarely failed, which is good news, but made it harder to see if autoheal was working.

It turned out that autoheal: true was the problem. true needs to be quoted: autoheal: "true", as autoheal searches for the lowercase value. Just true gets translated to a True boolean by docker compose, which autoheal doesn't search for.

So....

  • Should autoheal also accept the True?
  • Perhaps it is enough to just add a quick note to the README, warning about the quotes?
  • A short message upon startup (echo "autoheal is running") would personally have helped me to be sure the logging was actually working. I never got any output out of the tool because of the true/True mismatch, but I spend quite some time figuring out whether there was actually something wrong with my logging. That's why the tty: true is in there, for instance.
@reinout
Copy link
Author

reinout commented Aug 28, 2023

Unrelated to the documentation issue... I could probably have omitted the label entirely in my case? I only used it to restrict autoheal to my containers with a health check, preventing autoheal from looking at the non-health-check containers.
Autoheal searches for {"health": "unhealthy"}, so containers without a health check are completely ignored in any case, it seems.

@hasnat
Copy link
Contributor

hasnat commented Aug 28, 2023

this certainly can be an annoying, I recall docker-compose has got tendencies to do conversions on yml which IMO it shouldn't.
I'd be nice to turn autoheal check to 1/True/true/yes like.

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

2 participants