vladgh / docker_base_images

Vlad's Base Images for Docker
Apache License 2.0
90 stars 41 forks source link

Healthcheck don't pass when minidlna tcp port is changed. #246

Closed Hadatko closed 1 year ago

Hadatko commented 1 year ago

Hello, thank you for this container i am trying today. I am getting this warning/error. Are we able to solve it somehow?

I don't know if this is the rootcouse of the unhealty state of container but until this message there wasn't unhealty state:

image

vladgh commented 1 year ago

Please share the log output from the container.

Hadatko commented 1 year ago

Actually i tried reboot container and it is unhealty also without the warning above:

image

And failure count is increasing

Hadatko commented 1 year ago

I see that you are running healtcheck on different port than it is defined in minidlna enviroment variable. curl --silent --fail 127.0.0.1:8200 || exit 1

IS this the reason for it?

vladgh commented 1 year ago

Yes, that must be it. But that's not something I can modify at build time, in the image. You must override the health check at runtime, in Portainer or docker-compose, or whatever you use.

Hadatko commented 1 year ago

You cannot set Healtcheck to something like this? Just thinking if we can solve it easily ;)

HEALTHCHECK --interval=10s --timeout=10s --retries=6 CMD \
  sh -c 'test -n "$MINIDLNA_PORT" || MINIDLNA_PORT=8200; \
  curl --silent --fail "http://127.0.0.1:$MINIDLNA_PORT" || exit 1'
Hadatko commented 1 year ago

I see this in image:

image

But this in container using newer image:

image

I will try changes locally and see

vladgh commented 1 year ago

It should work as expected:

Screenshot 2023-08-09 at 9 46 19 AM Screenshot 2023-08-09 at 9 46 45 AM Screenshot 2023-08-09 at 9 46 30 AM

Hadatko commented 1 year ago

Hi finally it is working. Not sure where was the issue, but minidlna is now using correct Healthcheck updated command (maybe i had to recreate minidlna, or do update on stack context and not container context...)

Tahnk you for helping and solving the issue ;)

image