Notifications¶
docker-backup can send notifications when backup events occur. Notifications are opt-in per container using the docker-backup.notify label.
Notification Events¶
| Event | Description |
|---|---|
backup_started |
Backup operation has begun |
backup_completed |
Backup completed successfully (includes size and duration) |
backup_failed |
Backup failed (includes error message) |
restore_started |
Restore operation has begun |
restore_completed |
Restore completed successfully |
restore_failed |
Restore failed (includes error message) |
Provider Configuration¶
Notification providers are configured using DSN (Data Source Name) strings. The notification system uses go-notifier, which supports:
- Telegram - Chat-based notifications
- Slack - Team messaging
- Discord - Server notifications with rich embeds
- Gotify - Self-hosted push notifications
- Microsoft Teams - Enterprise messaging
CLI Configuration¶
Environment Variable Configuration¶
Provider names are uppercase in environment variables.
Telegram¶
Send notifications via Telegram Bot API.
Setup¶
- Create a bot with @BotFather
- Get your chat ID (send a message to your bot, then check
https://api.telegram.org/bot<TOKEN>/getUpdates)
Configuration¶
DSN Format¶
BOT_TOKEN: Bot token from @BotFatherCHAT_ID: Chat/group/channel ID to send messages to
Example Message¶
Discord¶
Send notifications via Discord webhooks.
Setup¶
- Go to Server Settings > Integrations > Webhooks
- Create a new webhook and copy the URL
Configuration¶
DSN Format¶
Extract the WEBHOOK_ID and WEBHOOK_TOKEN from your webhook URL:
Slack¶
Send notifications via Slack.
Configuration¶
DSN Format¶
Gotify¶
Send notifications to a self-hosted Gotify server.
Configuration¶
DSN Format¶
Microsoft Teams¶
Send notifications via Microsoft Teams webhooks.
Configuration¶
DSN Format¶
Multiple Providers¶
Configure multiple notification providers:
docker-backup daemon \
--notify=telegram='telegram://123456:ABC@default?channel=-100123...' \
--notify=discord='discord://webhook_token@default?webhook_id=1234567890'
Container Configuration¶
Notifications are opt-in. Enable them per container using labels.
Enable for Container¶
labels:
- docker-backup.enable=true
- docker-backup.notify=telegram
- docker-backup.db.type=postgres
- docker-backup.db.schedule=0 3 * * *
Multiple Providers¶
Per-Config Override¶
labels:
- docker-backup.enable=true
- docker-backup.notify=telegram
# Uses global notify (telegram)
- docker-backup.hourly.type=postgres
- docker-backup.hourly.schedule=0 * * * *
# Override: send to discord instead
- docker-backup.daily.type=postgres
- docker-backup.daily.schedule=0 3 * * *
- docker-backup.daily.notify=discord
Complete Example¶
compose.yml
services:
docker-backup:
image: ghcr.io/shyim/docker-backup:latest
environment:
# Telegram for critical alerts
DOCKER_BACKUP_NOTIFY_TELEGRAM: 'telegram://${TELEGRAM_BOT_TOKEN}@default?channel=${TELEGRAM_CHAT_ID}'
# Discord for team channel
DOCKER_BACKUP_NOTIFY_DISCORD: 'discord://${DISCORD_WEBHOOK_TOKEN}@default?webhook_id=${DISCORD_WEBHOOK_ID}'
command:
- daemon
- --storage=local.type=local
- --storage=local.path=/backups
- --default-storage=local
postgres:
image: postgres:16
labels:
- docker-backup.enable=true
- docker-backup.notify=telegram,discord
- docker-backup.db.type=postgres
- docker-backup.db.schedule=0 3 * * *