Monitor your Docker containers effortlessly and receive real-time alerts in Discord
1.1K
Monitor your Docker containers effortlessly and receive real-time alerts in Discord. This project leverages Docker Compose to run the monitoring script as a continuous service, ensuring you stay informed on container events such as start, stop, restart, and failures.
Create a compose.yaml file
An example compose.yaml file is included, make sure you replace the DISCORD_WEBHOOK_URL value with one you obtained from Discord:
services:
docker-discord-alerts:
container_name: docker-discord-alerts
image: ghcr.io/rycochet/docker-discord-alerts:latest
restart: unless-stopped
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro" # or use the `DOCKER_HOST` variable
environment:
DISCORD_WEBHOOK_URL: "https://discord.com/api/webhooks/..."
Start the Service
Use Docker Compose to start the service in the background:
docker-compose up -d
Trigger Docker Events
Start, stop, or restart Docker containers to trigger notifications:
docker start your_container_name
docker stop your_container_name
docker restart your_container_name
Check Discord
Notifications will appear in the designated Discord channel with details about each container event.
Ensure Docker and Docker Compose are running correctly.
Verify that the Discord webhook URL is correct and active.
Check for any errors in the container logs:
docker logs docker-discord-alerts
| Name | Definition | Default |
|---|---|---|
DISCORD_WEBHOOK_URL | Required The full webhook URL from Discord, see here | |
CONTAINERS | A comma-separated list of container names, or * for "everything" | * |
DOCKER_HOST | If using socket-proxy you should pass the URI for it here. | |
EVENTS | A comma separated list of events to watch. There are two special values, all for everything, or default for a smaller list (see separate table). | default |
EXTRA | A string to send with every alert, perfect for sending @mentions for people. You need to obtain the ID (see here) and format as <@USER_ID> or <@&ROLE_ID>, but can put any text here. | |
LOG_LEVEL | How much to log: DEBUG, INFO, WARNING, ERROR, CRITICAL | INFO |
VERBOSE | Provide more detail for the Discord messages. (True / False) | False |
These are the supported docker events, and the colour of the notifications for each.
| Event | Description | Default |
|---|---|---|
create | ⏺️ Container Created | |
start | ▶️ Container Started | ✅ |
pause | ⏸️ Container Paused | ✅ |
unpause | ⏯️ Container Unpaused | ✅ |
restart | 🔁 Container Restarted (will also show both stop and start) | |
stop | ⏹️ Container Stopped | ✅ |
kill | 💀 Container Killed | |
die | ⏏️ Container Died (includes both stop and kill) | |
health_status | 🩺 Health Status | ✅ |
Content type
Image
Digest
sha256:07dd01802…
Size
21.6 MB
Last updated
8 months ago
docker pull rycochet/docker-discord-alerts