Skip to content

An easy-to-use Discord bot to manage your Docker containers.

License

Notifications You must be signed in to change notification settings

alex289/docker-discord-bot

Repository files navigation

Docker Discord Bot

GitHub License Docker Pulls CodeFactor Docker Image Size

An easy-to-use Discord bot to manage your Docker containers.

Table of Contents

Commands

Command Description
!help Show all available commands
!ping Check if the bot is online
!dockerps List all running Docker containers
!dockerstop <container> Stop a Docker container
!dockerstart <container> Start a Docker container
!dockerrestart <container> Restart a Docker container
!dockerremove <container> Remove a Docker container
!dockershow <container> Show information about a Docker container
!dockercreate <image>:<tag>/<image> <name> <ports (80:80,81:81)> Create a new Docker container
!dockerinfo Show information about the Docker host
!dockerimages List all existing images
!dockerpull <image>:<tag>/<image> Pull an image
!dockerremoveimage <image> Remove an image

Installation

Discord Bot Setup

  1. Create a new Discord bot at the Discord Developer Portal
  2. Copy the bot token
  3. Invite the bot to your server using the following link: https://discord.com/oauth2/authorize?client_id=YOUR_BOT_ID&permissions=8&scope=bot

Docker Setup

Run the following command to start the Docker container:

docker run \
    -d \
    --name docker-discord-bot \
    -u root \
    -e ApplicationSettings__DiscordToken=YOUR_DISCORD_BOT_TOKEN \
    -v /var/run/docker.sock:/var/run/docker.sock \
    alexdev28/docker-discord-bot:latest

Or with docker compose:

version: '3.8'

services:
  docker-discord-bot:
    image: alexdev28/docker-discord-bot:latest
    container_name: docker-discord-bot
    restart: unless-stopped
    user: root
    environment:
      - ApplicationSettings__DiscordToken=YOUR_DISCORD_BOT_TOKEN
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

Configuration

The bot can be configured using environment variables:

Environment Variable Description Default Value Required
ApplicationSettings__DiscordToken Discord bot token null
ApplicationSettings__AdminUser Discord admin username null
ApplicationSettings__CommandPrefix Command prefix !
ApplicationSettings__DockerRegistryUrl Private registry url null
ApplicationSettings__DockerRegistryUsername Private registry username null
ApplicationSettings__DockerRegistryPassword Private registry password null

License

© Alexander Konietzko 2024
Released under the MIT license

About

An easy-to-use Discord bot to manage your Docker containers.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published