Somewhere on internet I saw next example for healthcheck inside docker-compose.yml for monitoring PowerDNS:
healthcheck:
test: [ "CMD", "host", "-W", "1", "-t", "AAAA", "www.google.com", "172.22.22.23" ]
interval: 35s
timeout: 4s
But this does not work, because of next error:
OCI runtime exec failed: exec failed: unable to start container process: exec: "host": executable file not found in $PATH: unknown
What is the better command to use at healthcheck for PowerDNS?
My suggestion not is not devops best practice (i guess), but i can suggest next.
I assume that a healthy PDNS container is a container which has access to database with zones.
PDNS container apparently will not exit if connection to DB is lost.
So my suggestion is to use
pdnsutil(cli tool which installed with pdns) to call some commands to check if connection is alive.For example, we can try to create and delete zone (which is kinda bad for DNS server)
Or empty zone can be created only for healthchecking purposes - to get info about it (it should be created because Not Found zone will be considered as error)