documentation/cookbook/operations/docker-compose-config.md
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.
To override configuration parameters via environment variables:
QDB_: Add QDB_ before the parameter name. to _For example:
pg.user becomes QDB_PG_USERpg.password becomes QDB_PG_PASSWORDcairo.sql.copy.buffer.size becomes QDB_CAIRO_SQL_COPY_BUFFER_SIZE:::tip
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
:::
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:
boratclever_password./questdb/questdb_root on the host machine:::warning Volume Permissions
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.
:::
services:
questdb:
image: questdb/questdb
user: "1000:1000"
environment:
- QDB_CAIRO_ROOT=/var/lib/questdb
volumes:
- ./questdb_data:/var/lib/questdb
For a full list of available configuration parameters, see:
:::info Related Documentation