Skip to content

socialmetrix/docker-events-notifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Events Notifier

Receive Slack notifications when a container dies

How it works

This image connects to the host machine socket, through a volume mapping, and listen Docker Events API.

When a die event is triggered it sends the affected containers' information to the selected Slack channel.

Build

You must create a release tag in order to build and publish this image.

./build-all.sh

Run

  1. Because this app is just for you, you'll be fine with a Slack Tokens for Testing and Development

Single docker engine

Run the container on a single docker engine, using slack api key and channel.

docker run \
    -d --restart=always \
    -v /var/run/docker.sock:/var/run/docker.sock \
    -e SLACK_API_KEY="xoxp-9999999999-9999999999-9999999999-99999999999999999999999" \
    -e SLACK_CHANNEL="#foo" \
    socialmetrix/docker-events-notifier:${VERSION}

Docker swarm mode

Run the container on every node of your swarm.

docker service create \
    --mode global \
    --restart-condition any \
    --mount type=bind,src=/var/run/docker.sock,dst=/var/run/docker.sock \
    -e SLACK_API_KEY="xoxp-9999999999-99999999999-999999999999-99999999999999999999999999999999" \
    -e SLACK_CHANNEL="#foo" \
    --name docker-events-notifier \
    socialmetrix/docker-events-notifier:${VERSION}

License

Apache License Version 2.0