Sign inSign up

thtom/docker-telegram-notifier

By thtom

Updated over 4 years ago

Fork from poma/docker-telegram-notifier to rebuild it for multiarch

Image
0

277

thtom/docker-telegram-notifier repository overview

Fork from poma/docker-telegram-notifier to rebuild it for multiarch


Docker Telegram Notifier Docker Cloud Build Status

A Telegram integration to notify Docker events. This service notifies about container start, stop, restart events, and changes of Docker healthcheck status. If you wish you can add more event notifications in templates.js file.

How to Run

Set up a telegram bot and get the Bot Token. then add the bot to a group and make it admin and extract the Chat ID, by follow this link with your bot token : https://api.telegram.org/bot<YourBOTToken>/getUpdates. And find Chat ID by sending messages to your bot or in your group chat.

Run a container as follows:

# Docker
docker run -d --env TELEGRAM_NOTIFIER_BOT_TOKEN=token --env TELEGRAM_NOTIFIER_CHAT_ID=chat_id --volume /var/run/docker.sock:/var/run/docker.sock:ro poma/docker-telegram-notifier
# Docker Compose
curl -O https://raw.githubusercontent.com/poma/docker-telegram-notifier/master/docker-compose.yml
docker-compose up -d

Blacklist and Whitelist

You can suppress notifications from certain containers by adding a label --label telegram-notifier.monitor=false to them. If you want to receive notifications only from whitelisted containers, set --env ONLY_WHITELIST=true environment variable on the notifier instance, and --label telegram-notifier.monitor=true label on the containers you want to monitor.

Remote docker instance

By default notifier connects to a local docker instance (don't forget to specify --volume /var/run/docker.sock:/var/run/docker.sock:ro for this case). But if you have monitoring and the service on the same host, you will not receive notifications if the host goes down. So I recommend to have monitoring separately.

Notifier accepts usual DOCKER_HOST and DOCKER_CERT_PATH environment variables to specify remote instance. For http endpoint you need to specify only --env DOCKER_HOST=tcp://example.com:2375 (make sure to keep such instances behind the firewall). For https, you'll also need to mount a volume with https certificates that contains ca.pem, cert.pem, and key.pem: --env DOCKER_HOST=tcp://example.com:2376 --env DOCKER_CERT_PATH=/certs --volume $(pwd):/certs Tutorial on how to generate docker certs can be found here

docker-compose

For docker-compose examples see comments in docker-compose.yml file.

Tag summary

Content type

Image

Digest

Size

28.3 MB

Last updated

over 4 years ago

docker pull thtom/docker-telegram-notifier