docker-db-backup icon indicating copy to clipboard operation
docker-db-backup copied to clipboard

HEALTCHECK for container

Open christianuhlmann opened this issue 4 years ago • 4 comments

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

christianuhlmann avatar Oct 31 '19 16:10 christianuhlmann

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.

tiredofit avatar Oct 31 '19 16:10 tiredofit

I think the health check could check if it still get connection to the specified database?

jwillmer avatar Nov 13 '19 14:11 jwillmer

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.

tiredofit avatar Nov 13 '19 14:11 tiredofit

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 :-)

bf8392 avatar Apr 25 '20 08:04 bf8392