This project publishes a Docker image you can pull and run: knight1988/duel-bot.
The image requires two environment variables to run:
DiscordToken — your bot token from the Discord Developer Portal.DatabaseConnectionString — a Postgres connection string (see example below).Connection string format (Npgsql / .NET):
Host=HOST;Port=5432;Database=DB_NAME;Username=DB_USER;Password=DB_PASS
Pull the image:
docker pull knight1988/duel-bot:latest
Run the bot (replace the values with your own):
docker run -d \
--name duel-bot \
-e DiscordToken="YOUR_DISCORD_TOKEN" \
-e DatabaseConnectionString="Host=host;Port=5432;Database=duel_db;Username=duel_user;Password=secret" \
--restart unless-stopped \
knight1988/duel-bot:latest
If your Postgres database runs on the same host and is listening on the default port, use Host=host.docker.internal on Docker Desktop for Windows to reach the host network from the container.
Start a lightweight Postgres container for local testing:
docker run -d \
--name duel-db \
-e POSTGRES_DB=duel_db \
-e POSTGRES_USER=duel_user \
-e POSTGRES_PASSWORD=secret \
-p 5432:5432 \
postgres:15-alpine
Then point the bot to it with:
Host=localhost;Port=5432;Database=duel_db;Username=duel_user;Password=secret
Create a docker-compose.yml with both Postgres and the bot. This example uses a simple healthcheck and depends_on to wait for Postgres.
version: '3.8'
services:
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: duel_db
POSTGRES_USER: duel_user
POSTGRES_PASSWORD: secret
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U duel_user"]
interval: 5s
retries: 5
duel-bot:
image: knight1988/duel-bot:latest
environment:
- DiscordToken=${DISCORD_TOKEN}
- DatabaseConnectionString=Host=db;Port=5432;Database=duel_db;Username=duel_user;Password=secret
depends_on:
db:
condition: service_healthy
restart: unless-stopped
# Run with: DISCORD_TOKEN=yourtoken docker-compose up -d
Notes and tips
DiscordToken secret. Avoid hard-coding it into checked-in files.Content type
Image
Digest
sha256:a196c7d31…
Size
94.7 MB
Last updated
about 1 month ago
docker pull knight1988/duel-bot