survivalful/discord-docker-bot

By survivalful

•Updated 5 months ago

Image
Message queues
0

674

survivalful/discord-docker-bot repository overview

⁠🐳 Discord Docker Monitor Bot

Docker Pulls License: GPL v3 Docker Image Size

Monitor your Docker containers directly from Discord — automatic status updates every 30 seconds, crash alerts, uptime tracking, and full container control via slash commands.

Screenshot


⁠✨ Features

  • šŸ“‹ List all Docker containers on your host
  • šŸ“ Group containers with dedicated Discord channels
  • šŸ”„ Automatic status updates every 30 seconds
  • 🟢 Live status indicators (running, exited, paused, created)
  • ā±ļø Uptime display for running containers
  • 🚨 Crash alerts — configurable per group channel or a separate alert channel
  • ā–¶ļø Start / ā¹ļø Stop containers directly from Discord
  • šŸ“‹ View live logs of any container (last 20 lines)
  • šŸ”’ Read-only channels for regular users
  • šŸ„ Health check endpoint on :8080/health

ā šŸš€ Quick Start

Option A — Docker Run (fastest)

docker run -d \
  --restart unless-stopped \
  -e BOT_TOKEN=your_token \
  -e DOCKER_HOST=tcp://your-host:2375 \
  -e GUILD_ID=your_guild_id \
  -e CATEGORY_NAME="Docker Status" \
  -p 8080:8080 \
  survivalful/discord-docker-bot:latest

Option B — Docker Compose (recommended)

  1. Create your .env file:
BOT_TOKEN=your_discord_bot_token
DOCKER_HOST=tcp://your-docker-host:2375
GUILD_ID=your_discord_server_id
CATEGORY_NAME=Docker Status
  1. Create your docker-compose.yml:
services:
  discord-bot:
    image: survivalful/discord-docker-bot:latest
    restart: unless-stopped
    env_file:
      - .env
    ports:
      - "8080:8080"
  1. Start it:
docker compose up -d

That's it! šŸŽ‰

After the bot starts, run /setup in Discord to configure your alert preferences.


ā šŸ¤– Commands

All commands are slash commands (/).

CommandDescription
/infoShows all available commands
/setupConfigure crash alert mode and alert channel
/container_listLists all containers with status and uptime
/container_start <name>Starts a container
/container_stop <name>Stops a container
/container_logs <name>Shows the last 20 log lines of a container
/group_create <name> <containers>Creates a group with a dedicated channel
/group_remove <name>Deletes a group and its channel
/group_listShows all existing groups

Note: Container and group names support autocomplete.


⁠🚨 Crash Alerts

Configure alert behaviour with /setup:

Alert ModeBehaviour
In each group channelCrash alerts are posted in the group channel the container belongs to
In a separate alert channelAll crash alerts go to a single dedicated channel

A crash is detected when a container transitions from running → exited during the 30-second monitoring cycle.


ā šŸ“Š Status Indicators

SymbolStatus
🟢Running
šŸ”“Exited
🟔Paused
⚪Created
ā“Unknown

Running containers also display their uptime (e.g. 2d 4h 15m).


ā āš™ļø Configuration

Environment VariableRequiredDefaultDescription
BOT_TOKENāœ…ā€”Your Discord bot token
DOCKER_HOSTāœ…ā€”Docker remote API URL (e.g. tcp://host:2375)
GUILD_IDāœ…ā€”Your Discord server ID
CATEGORY_NAMEāŒDocker StatusCategory name for group channels

Alert settings (mode and channel) are saved persistently in settings.json via /setup.


ā šŸ„ Health Check

The bot exposes a health check endpoint at:

GET http://<host>:8080/health

Returns 200 OK when the bot is running. Useful for container orchestration or uptime monitoring tools like Uptime Kuma.


ā āš ļø Security Warning

Port 2375 is unencrypted and unauthenticated. Anyone with network access to that port can control your Docker daemon.

Recommendations:

  • Use a firewall to restrict access to port 2375
  • Only expose it on a trusted local network
  • Consider using Docker socket proxy as a safer alternative
  • Never expose port 2375 to the public internet

ā šŸ› ļø Troubleshooting

Bot starts but no channels are created → Check that GUILD_ID is correct and the bot has Manage Channels permission.

"Cannot connect to Docker" → Make sure the Docker remote API is enabled and DOCKER_HOST points to the right address.

Slash commands don't appear → Make sure the bot has the applications.commands scope. Commands are synced to the guild on startup.

Status stops updating → Restart the container: docker compose restart

Bot is offline in Discord → Check your BOT_TOKEN and verify the bot is still in your server.

No crash alerts received → Run /setup to configure an alert mode — without setup, alerts may fall back to the first available group channel.


ā šŸ¤ Contributing

Contributions are welcome! Open an issue or submit a pull request on the Git repository⁠.


ā šŸ“„ License

Licensed under GNU GPL v3.0⁠ — free to use, modify and distribute, but changes must stay open-source.


ā šŸ› ļø Support

Tag summary

Content type

Image

Digest

sha256:19667962f…

Size

51.3 MB

Last updated

5 months ago

docker pull survivalful/discord-docker-bot