docker-db-backup
docker-db-backup copied to clipboard
HEALTCHECK for container
Hi,
i want to enable docker HEALTHCHECK (https://docs.docker.com/engine/reference/builder/#healthcheck). do you have any idea how to enable this feature for your container?
Regards Christian
Thanks for this - I believe in that example it seems that HEALTHCHECK probes for a listening service (ie a webserver). The way I've built this is that it runs on a timer based on your backup frequency environment variable, and when it is time to perform the backup, it does check to see if the database is available to accept connections. If not available, it will wait until it is available however there is no alerts to an external service if it has not connected. What I do have built in is Zabbix reporting when a backup is successful or failed, I could potentially add in some sort of alert to Zabbix if after a certain amount of times it can't connect.
I think the health check could check if it still get connection to the specified database?
https://github.com/tiredofit/docker-db-backup/blob/master/install/etc/s6/services/10-db-backup/run - Lines 196-266 Cover this in the most basic way.
Look at https://github.com/tiredofit/docker-db-backup/issues/29. Maybe this is a better solution for your monitoring? You can call a script, that probes a connection, and sends a message if successful, or writes to log...would that be good? :-). Your problem should be solved by that :-)