docker-autoheal icon indicating copy to clipboard operation
docker-autoheal copied to clipboard

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

Open reinout opened this issue 2 years ago • 4 comments

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 avatar Aug 28 '23 07:08 reinout

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.

reinout avatar Aug 28 '23 09:08 reinout

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.

hasnat avatar Aug 28 '23 09:08 hasnat

What is the status of this issue? I am trying to implement this container with haugene/docker-transmission-openvpn, and I think this issue is preventing it from working.

docker-transmission-openvpn has the label built in, but not in quotes so this may be keeping it from getting healed.

benyjr avatar Dec 23 '24 21:12 benyjr

What is the status of this issue? I am trying to implement this container with haugene/docker-transmission-openvpn, and I think this issue is preventing it from working.

docker-transmission-openvpn has the label built in, but not in quotes so this may be keeping it from getting healed.

Have you tried simply overwriting the label?

    labels:
      - autoheal="false"

ovizii avatar May 27 '25 22:05 ovizii