Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bash script that posts Docker Events to Telegram

License

NotificationsYou must be signed in to change notification settings

JulyIghor/DockerEvents

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple Bash script that posts Docker Events to Telegram. It is minimal implementation and it is using a few MB of RAM and low CPU usage.

It is built for all architectures supported byalpine docker image.

By default it is sending containerstart/stop/unhealthy status for non zero exit codes and ignoring containers that started with the restart policy valueno.

You can defineHOST_NAME for each instance, or mount/etc/hostname as read only. That will be used in notification message title.

Also you can set up filters using environment variables to get notifications you need. Use bash patternswiki.bash-hackers.org/syntax/pattern

Environment variables

TELEGRAM_API_TOKEN - Telegram bot API key
TELEGRAM_GROUP_ID - Telegram group id
TELEGRAM_MENTION - list of Telegram usernames to mention, separated by spaces

FILTER_NAME - filter container name (default:+(*))
FILTER_IMAGE - filter image name (default:+(*))
FILTER_HEALTH - filter health status (default:!(healthy))
FILTER_EXITCODE - filter exit code (default:!(0|130))
FILTER_RESTART_POLICY - filter restart policy (default:!(no))

HOST_NAME - define a host name for notifications, by default it reads the/etc/hostname file
TIMEZONE - optional time zone for event time, for exampleAmerica/New_York

Example commands

docker run -d --name='DockerEvents' -e 'TELEGRAM_MENTION'='@ighor' -e 'TIMEZONE'='America/New_York' -e 'TELEGRAM_API_TOKEN'='..' -e 'TELEGRAM_GROUP_ID'='..' -v '/var/run/docker.sock':'/var/run/docker.sock':'ro' -v '/etc/hostname':'/etc/hostname':'ro' --cpus="0.1" -m 50M --restart always 'julyighor/dockerevents:latest'

Source code Mirrors

gitlab.com/ighor/DockerEvents
github.com/JulyIghor/DockerEvents

Docker registry

hub.docker.com/r/julyighor/dockerevents
registry.gitlab.com/ighor/dockerevents

About

Bash script that posts Docker Events to Telegram

Topics

Resources

License

Stars

Watchers

Forks


[8]ページ先頭

©2009-2026 Movatter.jp