Docker Notifier is a service that listens to container status events and sends notifications to Telegram.
To pull the latest Docker image, use the following command:
docker pull blackiq/docker-notifier:latestYou need to provide some essential configuration values such as Bot Token, Chat IDs, and a Hostname. Create a config.json file with the following structure:
{
"hostname": "your_host_name",
"bot_token": "bot_token",
"chat_ids": [1234, -9876],
"exit_chat_ids": [4321, -6789]
}hostname: Identifies the host in notifications.bot_token: Token for your Telegram bot. Create a bot via @BotFather on Telegram.chat_ids: IDs of Telegram chats to receive all status notifications.exit_chat_ids: IDs of Telegram chats to receive crash notifications only.
Ensure the config.json file is mounted to /etc/docker-notifier/config.json when running the container.
You can run the service using either the command line or Docker Compose.
Ensure the config.json file is ready, then run the container with the following command:
docker run -d \
--name docker-notifier \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /path/to/config.json:/etc/docker-notifier/config.json \
blackiq/docker-notifier:latestHere’s an example docker-compose.yml configuration:
version: "3"
services:
docker-notifier:
image: blackiq/docker-notifier:latest
container_name: docker-notifier
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- /path/to/config.json:/etc/docker-notifier/config.json
restart: alwaysRun the service with:
docker compose up -dFor a quicker setup, clone the repository and use the provided example directory:
git clone https://github.com/BlackIQ/docker-notifier.git
cd docker-notifier/exampleEdit the config.json file in the example directory to match your configuration, then start the service:
docker compose up -dWe’re always looking to improve Docker Notifier and would love your help! If you have ideas for features, bug fixes, or enhancements, feel free to contribute.
- Fork the repository.
- Create a feature branch.
- Submit a pull request with a detailed explanation.
Your feedback and contributions are greatly appreciated!