Monitor Docker container logs and get instant Telegram notifications when errors occur.
Docker Notifier watches your container logs for error patterns and sends notifications to Telegram when matches are found. Easily integrate with your existing Docker setup to get alerts about errors in real-time.
- 🔍 Monitor container logs for custom error patterns
- 🏷️ Filter containers by labels
- 📱 Send notifications to Telegram
- ⏱️ Configurable polling interval
- 🛠️ Simple integration with docker-compose
version: "3"
services:
docker-notifier:
image: ghcr.io/andvarfolomeev/docker-notifier:main
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
environment:
- TELEGRAM_TOKEN=your_telegram_bot_token
- TELEGRAM_CHAT_ID=your_telegram_chat_id
command: >
/app/docker-notifier
--interval 5
--label-enable
--telegram-token "${TELEGRAM_TOKEN}"
--telegram-chat-id "${TELEGRAM_CHAT_ID}"
--error-pattern "ERROR"
--error-pattern "FATAL"
--error-pattern "Exception"
# Example service to monitor
example-service:
image: alpine:latest
labels:
- "com.andvarfolomeev.dockernotifier.enable=true"
command: >
sh -c "while true; do echo 'Normal log line'; sleep 5; echo 'ERROR: This is an error message'; sleep 10; done"
docker run -d \
--name docker-notifier \
-v /var/run/docker.sock:/var/run/docker.sock \
ghcr.io/andvarfolomeev/docker-notifier:main \
/app/docker-notifier \
--telegram-token "your_telegram_bot_token" \
--telegram-chat-id "your_telegram_chat_id" \
--error-pattern "ERROR" \
--error-pattern "FATAL"
Argument | Description | Default |
---|---|---|
--interval |
Log polling interval in seconds | 5 |
--label-enable |
Enable label filter (only monitor containers with the label) | false |
--telegram-token |
Telegram Bot API token (required) | - |
--telegram-chat-id |
Target Telegram chat ID (required) | - |
--error-pattern |
Regex pattern for matching error lines (can be used multiple times) | "ERROR" |
--debug |
Enable debug logging | false |
--help |
Display help information | - |
When --label-enable
is set, Docker Notifier will only monitor containers with this label:
com.andvarfolomeev.dockernotifier.enable=true
- Create a new bot via @BotFather on Telegram
- Get your bot token
- Start a conversation with your bot
- Get your chat ID (using @userinfobot or other methods)
- Use these values for
--telegram-token
and--telegram-chat-id
MIT