Example docker compose:
services:
container-mon:
container_name: container-mon
image: ghcr.io/rafhaanshah/container-mon:latest
restart: unless-stopped
deploy:
resources:
limits:
cpus: '0.1' # 10% of 1 CPU core
memory: 64M # 64MB RAM limit
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- CONTAINERMON_NOTIFICATION_URL=${CONTAINERMON_NOTIFICATION_URL}
# Check every 1 minute
- CONTAINERMON_CRON=*/1 * * * *
# Send notification after 0 consecutive unhealthy check
- CONTAINERMON_FAIL_LIMIT=0
# Notify when containers become healthy again
- CONTAINERMON_NOTIFY_HEALTHY=true
# Monitor stopped containers as unhealthy
- CONTAINERMON_CHECK_STOPPED=true
# Optional: Add a custom prefix to messages
- CONTAINERMON_MESSAGE_PREFIX=[container-mon]
# Optional: Only monitor containers with label "containermon.enable=true"
# - CONTAINERMON_USE_LABELS=false
The Telegram URL is:
telegram://[token]@telegram?channels=[chat_id]