Automatic docker health check monitoring and reporting
healthmon
is a Docker image that monitors all containers on the running system that report health checks. Upon a change, it sends a notification using Apprise.
healthmon
can be run simply with a docker-compose.yml file.
services:
healthmon:
image: ghcr.io/zackelia/healthmon:latest
container_name: healthmon
restart: unless-stopped
hostname: my-server
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
# Find all supported URLs at: https://github.com/caronc/apprise
- APPRISE_URL=mailto://userid:pass@domain.com
For services not supported by Apprise, you can create custom/hooks.py
and mount it at ./custom:/custom
. The content of this file can be created using Apprise's Custom Notifications page. On container start, healthmon
will log that it loaded the custom hooks.
healthmon
requires mounting in /var/run/docker.sock
which is inherently dangerous as it allows trivial access to root on the host.
To remedy this, healthmon
creates a non-privileged user that is only allowed to run a specific docker events
command to subscribe to health status messages. No other elevated permissions are granted.