Configure QuestDB with Docker Compose
You can override any QuestDB configuration parameter using environment variables in Docker Compose. This is useful for setting custom ports, authentication credentials, memory limits, and other operational settings without modifying configuration files.
Environment Variable Format
To override configuration parameters via environment variables:
- Prefix with
QDB_: AddQDB_before the parameter name - Capitalize: Convert to uppercase
- Replace dots with underscores: Change
.to_
For example:
pg.userbecomesQDB_PG_USERpg.passwordbecomesQDB_PG_PASSWORDcairo.sql.copy.buffer.sizebecomesQDB_CAIRO_SQL_COPY_BUFFER_SIZE
Example: Custom PostgreSQL Credentials
This Docker Compose file overrides the default PostgreSQL wire protocol credentials:
version: "3.9"
services:
questdb:
image: questdb/questdb
container_name: custom_questdb
restart: always
ports:
- "8812:8812"
- "9000:9000"
- "9009:9009"
- "9003:9003"
extra_hosts:
- "host.docker.internal:host-gateway"
environment:
- QDB_PG_USER=borat
- QDB_PG_PASSWORD=clever_password
volumes:
- ./questdb/questdb_root:/var/lib/questdb/
This configuration:
- Sets PostgreSQL wire protocol username to
borat - Sets password to
clever_password - Persists data to
./questdb/questdb_rooton the host machine - Exposes all QuestDB ports (web console, HTTP, ILP, PostgreSQL wire)
Common Configuration Examples
Increase Write Buffer Size
environment:
- QDB_CAIRO_SQL_COPY_BUFFER_SIZE=4194304
- QDB_LINE_TCP_MAINTENANCE_JOB_INTERVAL=500
Configure Memory Limits
environment:
- QDB_CAIRO_SQL_PAGE_FRAME_MAX_ROWS=1000000
- QDB_CAIRO_SQL_PAGE_FRAME_MIN_ROWS=100000
Enable Debug Logging
environment:
- QDB_LOG_LEVEL=DEBUG
- QDB_LOG_BUFFER_SIZE=1048576
Custom Data Directory Permissions
services:
questdb:
image: questdb/questdb
user: "1000:1000"
environment:
- QDB_CAIRO_ROOT=/var/lib/questdb
volumes:
- ./questdb_data:/var/lib/questdb
Complete Configuration Reference
For a full list of available configuration parameters, see:
- Server Configuration Reference - All configurable parameters with descriptions
- Docker Deployment Guide - Docker-specific setup instructions
Verifying Configuration
After starting QuestDB with custom configuration, verify the settings:
-
Check logs: View container logs to confirm configuration was applied:
docker compose logs questdb -
Query system tables: Connect via PostgreSQL wire protocol and query configuration:
SELECT * FROM sys.config; -
Web console: Access the web console at
http://localhost:9000and check the "Configuration" tab
Keep sensitive configuration like passwords in a .env file and reference them in docker-compose.yml:
environment:
- QDB_PG_PASSWORD=${QUESTDB_PASSWORD}
Then create a .env file:
QUESTDB_PASSWORD=your_secure_password
If you encounter permission errors with mounted volumes, ensure the QuestDB container user has write access to the host directory. You may need to set ownership with chown -R 1000:1000 ./questdb_root or run the container with a specific user ID.