Docker Compose Integration
BranchBase auto-detects database services from Docker Compose configurations and sets up port routing for the transparent proxy.
Auto-Detection during branchbase init
When you run branchbase init, BranchBase scans for:
- docker-compose.yml
- docker-compose.yaml
- compose.yml
- compose.yaml
It automatically extracts:
- Database service engine: PostgreSQL (postgres:16), MySQL (mysql:8), MariaDB (mariadb:11).
- Host port mappings: e.g., 5433:5432 or 3307:3306.
- Environment credentials: POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD, MYSQL_DATABASE, etc. The MariaDB 10.6+ variables MARIADB_DATABASE, MARIADB_USER, MARIADB_PASSWORD, and MARIADB_ROOT_PASSWORD are supported, with the corresponding MYSQL_* names retained as fallbacks.
Recommended Port Configuration
To use BranchBase's transparent proxy with Docker Compose:
-
Map your container's database port to an alternative host port (e.g.
5433on the host to5432in the container). This frees the standard host port (5432) for the BranchBase proxy: -
Configure BranchBase to listen on standard port
5432and forward to backend port5433: -
Start the proxy and run your application connecting to standard port
5432:
BranchBase intercepts connections on 127.0.0.1:5432, rewrites the startup handshake with your active branch database name, and streams traffic directly to the backend container on port 5433.