[solved] Pihole Docker container unhealthy

Hi, solved my own question but writing it up in case it helps others.

Was struggling with this for a while and it seemed to get worse with the latest build/container,
Environment is Debian Linux and Docker CE running in a VM. After a VM reboot, Pihole container would on occasionally become unhealthy. Didnt happen every time but was becoming unreliable.

Updated to the latest Pihole container and could not run the container for more than 5 mins.

Turns out, the health check is doing this
HEALTHCHECK &{["CMD-SHELL" "dig @127.0.0.1 pi.hole || exit 1"] "0s" "0s" "0s" '\x00'}
I tried this
dig @127.0.0.1 pi.hole
on the Docker host and the container itself which failed.

Ended up creating a hostname (pi.hole 192.168.4.168) on my internet router pointing to the IP of the Pihole container so that the health check command wouldn't fail.

Im not a Docker guru so maybe i am working around a different issue but at least it is solved!

cheers.