This Discord bot allows you to manage Docker containers directly from a Discord server.
337
This Discord bot allows you to manage Docker containers directly from a Discord server using slash commands. It provides functionalities such as starting, stopping, and restarting containers, listing running containers, and showing logs of a specific container.
Github code: You can see the code here
docker-py) and discord.py library for seamless interaction./docker <container_name> <action>: Manages containers with the actions start, stop, restartor logs. Example: /docker my_container start./list_containers: Lists all containers currently in the running state.DISCORD_TOKEN: The token for your Discord bot.docker-compose:Here’s an example of how to configure the bot using docker-compose:
services:
discord-bot:
container_name: discord_docker_bot
image: manucarcor/discord_docker_bot:latest
environment:
- DISCORD_TOKEN=your_discord_token
volumes:
- /var/run/docker.sock:/var/run/docker.sock
restart: unless-stopped
To use this bot, you need to create a bot in the Discord Developer Portal:
docker-compose.yml under DISCORD_TOKEN).To ensure the bot has the correct permissions:
bot and applications.commands (for slash commands).Send MessagesRead Messages/View ChannelsManage MessagesUse the URL generated in the previous step to invite the bot to your server. The bot will now be able to interact with the server where it’s invited, using the correct permissions.
Run the Bot: Ensure that your docker-compose.yml is configured correctly with the necessary environment variables. Then, run the following command to bring up the container:
docker-compose up -d
Commands in Discord: From any channel in the server where the bot is active, you can execute commands such as:
/docker <container_name> start: Start a specific container./list: List all running containers.This project is open for contributions. If you want to add new features, fix bugs, or add support for more languages, feel free to submit a pull request on the linked GitHub repository.
Content type
Image
Digest
sha256:378fa655f…
Size
151.2 MB
Last updated
about 2 years ago
docker pull manucarcor/discord_docker_bot