This document covers deployment of DB-GPT using Docker Compose, which orchestrates multiple services (database, webserver) as a single application stack. Docker Compose provides a declarative way to define service configurations, networking, and data persistence.
For information about building Docker images, see Docker Base Image and Build System. For source code installation, see Source Code Installation. For detailed configuration options, see Configuration Management.
The docker-compose.yml defines a two-service architecture consisting of a MySQL database and the DB-GPT webserver.
Sources: docker-compose.yml1-54
The db service runs MySQL Server for metadata storage.
| Configuration | Value | Purpose |
|---|---|---|
| Image | mysql/mysql-server | Official MySQL Server image |
| Port | 3306:3306 | MySQL default port exposed to host |
| Restart Policy | unless-stopped | Automatic restart except manual stop |
| Network | dbgptnet | Bridge network for service communication |
Environment Variables:
Sources: docker-compose.yml4-19
The webserver service runs the DB-GPT application server using the dbgpt start webserver command.
| Configuration | Value | Purpose |
|---|---|---|
| Image | eosphorosai/dbgpt-openai:latest | DB-GPT OpenAI mode image (CPU-based) |
| Command | dbgpt start webserver --config /app/configs/dbgpt-proxy-siliconflow-mysql.toml | Start webserver with specific configuration |
| Port | 5670:5670/tcp | DB-GPT webserver port |
| Restart Policy | unless-stopped | Automatic restart except manual stop |
| IPC Mode | host | Shared IPC namespace with host |
| Dependency | depends_on: db | Starts after db service |
Sources: docker-compose.yml20-44
The stack uses a custom bridge network named dbgptnet for inter-service communication.
Network Definition:
The bridge driver creates an isolated network where services can communicate using service names as hostnames. The webserver connects to MySQL using MYSQL_HOST=db, which resolves to the db service container IP.
Sources: docker-compose.yml51-54
The docker-compose.yml defines both named volumes (for Docker-managed persistence) and bind mounts (for host filesystem access).
Named Volumes:
| Volume Name | Mount Point | Purpose |
|---|---|---|
dbgpt-myql-db | /var/lib/mysql | MySQL database files (persistent) |
dbgpt-data | /app/pilot/data | Application data files |
dbgpt-message | /app/pilot/message | Message queue storage |
dbgpt-alembic-versions | (defined but not mounted) | Database migration versions |
Bind Mounts (db service):
| Host Path | Container Path | Purpose |
|---|---|---|
./docker/examples/my.cnf | /etc/my.cnf | MySQL server configuration |
./docker/examples/sqls | /docker-entrypoint-initdb.d | SQL scripts executed on first run |
./assets/schema/dbgpt.sql | /docker-entrypoint-initdb.d/dbgpt.sql | DB-GPT schema initialization |
Bind Mounts (webserver service):
| Host Path | Container Path | Purpose |
|---|---|---|
./configs | /app/configs | Configuration files (.toml) |
/data | /data | General data directory |
/data/models | /app/models | LLM model files |
Sources: docker-compose.yml12-16 docker-compose.yml30-36 docker-compose.yml46-50
The docker-compose.yml requires environment variables to be set before starting services.
Webserver Service:
| Variable | Example Value | Purpose | Required |
|---|---|---|---|
SILICONFLOW_API_KEY | ${SILICONFLOW_API_KEY} | API key for SiliconFlow LLM provider | Yes |
MYSQL_PASSWORD | aa123456 | MySQL root password | Yes |
MYSQL_HOST | db | MySQL service hostname | Yes |
MYSQL_PORT | 3306 | MySQL service port | Yes |
MYSQL_DATABASE | dbgpt | Database name | Yes |
MYSQL_USER | root | MySQL username | Yes |
Database Service:
| Variable | Value | Purpose |
|---|---|---|
MYSQL_USER | user | Non-root MySQL user |
MYSQL_PASSWORD | password | Non-root user password |
MYSQL_ROOT_PASSWORD | aa123456 | Root user password |
The compose file uses shell environment variable substitution for the API key:
Or pass it inline:
Sources: docker-compose.yml1-2 docker-compose.yml6-9 docker-compose.yml23-29
Both services use restart: unless-stopped, which means:
docker compose stopImportant Note: The compose file contains this comment:
The depends_on directive only waits for the container to start, not for MySQL to be fully initialized. Initial webserver startup may fail if MySQL is still executing initialization scripts. The restart: unless-stopped policy ensures automatic retry.
Sources: docker-compose.yml17 docker-compose.yml37-42
| Service | Container Port | Host Port | Protocol | Purpose |
|---|---|---|---|---|
| db | 3306 | 3306 | TCP | MySQL database access |
| webserver | 5670 | 5670 | TCP | DB-GPT web interface and API |
Access Points:
Sources: docker-compose.yml10-11 docker-compose.yml39-40
The webserver service mounts the ./configs directory and uses a specific configuration file specified in the command.
The default configuration file dbgpt-proxy-siliconflow-mysql.toml is specified in the command. Users can:
./configs/Example with different configuration:
For detailed configuration options, see Configuration Management.
Sources: docker-compose.yml22 docker-compose.yml31
Docker and Docker Compose installed:
API Key obtained:
Port availability:
Configuration files:
./configs/dbgpt-proxy-siliconflow-mysql.tomlVerification:
Sources: docker-compose.yml1-54
The docker-compose.yml uses eosphorosai/dbgpt-openai:latest, which is the CPU-based OpenAI proxy mode image. This image is lightweight and suitable for deployments using API-based LLMs.
| Image Tag | Base Image | Use Case | GPU Required |
|---|---|---|---|
eosphorosai/dbgpt:latest | CUDA 12.4 | Full local model support | Yes |
eosphorosai/dbgpt-openai:latest | Ubuntu 22.04 | API-based models only | No |
eosphorosai/dbgpt-vllm:latest | CUDA 12.4 | vLLM inference | Yes |
eosphorosai/dbgpt-llama-cpp:latest | CUDA 12.4 | LLAMA.cpp inference | Optional |
Switching to GPU-enabled image:
For building custom images, see Docker Base Image and Build System.
Sources: docker-compose.yml21 docker/base/Dockerfile1-130 .github/workflows/docker-image-publish-openai.yml42-49
OpenAI:
Local vLLM:
Using PostgreSQL instead of MySQL:
Backup named volumes:
Restore volumes:
Sources: docker-compose.yml1-54
Issue: webserver fails to start with database connection error
Issue: Port already in use
Issue: Permission denied on volume mounts
Issue: API key not recognized
Sources: docker-compose.yml1-54
| Configuration Aspect | Location | Default Value | Customization |
|---|---|---|---|
| MySQL root password | db.environment.MYSQL_ROOT_PASSWORD | aa123456 | Change in compose file |
| Database name | webserver.environment.MYSQL_DATABASE | dbgpt | Change in compose file |
| Model provider | webserver.command | SiliconFlow | Change config file |
| Webserver port | webserver.ports | 5670:5670 | Change host port |
| MySQL port | db.ports | 3306:3306 | Change host port |
| Configuration file | webserver.command --config | dbgpt-proxy-siliconflow-mysql.toml | Change in command |
| Model directory | webserver.volumes | /data/models:/app/models | Change host path |
| Restart policy | service.restart | unless-stopped | Change to always or on-failure |
Sources: docker-compose.yml1-54
Refresh this wiki