Docker lets you run SudoBot and its PostgreSQL database together in isolated containers without installing Node.js, Bun, or database software directly on your host. The SudoBot repository includes a multi-stageDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/onesoft-sudo/sudobot/llms.txt
Use this file to discover all available pages before exploring further.
Dockerfile and a docker-compose.yml that manage both the bot and the database as a single stack.
Using Docker also makes SudoBot portable — you can run it on any platform that supports Docker, including Windows, macOS, and Linux.
Prerequisites
Install the following tools before you begin:- Docker
- Docker Compose (included with Docker Desktop)
- Git
Setup steps
Configure environment variables
Create a The
.env.docker file in the project root. Docker Compose mounts this file into the container as /app/.env at runtime.DB_URL uses postgres as the hostname because that is the service name defined in docker-compose.yml — Docker’s internal DNS resolves it to the database container automatically. Do not change it to localhost.For the full list of supported environment variables, see the environment variables reference or the EnvironmentVariableSchema source file.
Set up the storage directory
Create a Docker Compose mounts
storage/ directory in the project root and copy the default config files into it:./storage to /app/storage inside the container. Keeping config files here ensures they persist across container rebuilds and are not overwritten by updates.Edit storage/config/config.json and storage/config/system.json to match your server settings before starting the bot.Build and start the containers
Start the full stack — SudoBot, PostgreSQL, and Adminer — with Docker Compose:The On first run, Docker will build the SudoBot image using the multi-stage
-d flag runs the containers in the background (detached mode). Remove it if you want to stream logs directly to your terminal:Dockerfile. This may take several minutes. Subsequent starts are faster because Docker caches the build layers.The database migration runs automatically on container startup if it has not been applied yet. SudoBot checks for a
.migration_status file before deciding whether to run migrations.What the Compose stack includes
Thedocker-compose.yml defines three services:
| Service | Description |
|---|---|
sudobot | The bot itself, built from the local Dockerfile. Exposes port 4000 for the REST API. |
postgres | PostgreSQL 16 (Alpine). Data is persisted in a named Docker volume (pgdata). |
adminer | A lightweight database UI accessible at http://localhost:8080. Useful for inspecting the database. |
Managing the containers
Customizing the setup
TheDockerfile and docker-compose.yml are included in the repository and are yours to modify. Common customizations include:
- Changing the PostgreSQL credentials — update both the
postgresservice environment block andDB_URLin.env.docker. - Removing the
adminerservice fromdocker-compose.ymlif you don’t need it. - Adding a reverse proxy service (such as Nginx) to the Compose stack to expose the REST API securely.
- Pinning the
postgresimage to a different version.
