【问题标题】:How to change postgres docker image wal level on setup?如何在设置中更改 postgres docker image wal 级别?
【发布时间】:2019-12-19 20:07:56
【问题描述】:
我正在为我的一个应用程序使用 postgres:11.6-alpine 图像,我想在设置时将图像 wal_level 设置为“逻辑”,最好使用 docker-compose。
我找到的解决方案需要你覆盖图像 postgresql.conf。但是我不想为了更改此设置而拥有完整的 postgresql.conf 文件。
有什么办法可以做到吗?
【问题讨论】:
标签:
postgresql
docker
docker-compose
【解决方案1】:
像这样更新 PostgreSQL 容器配置的 command 部分。
services:
postgres:
image: postgres:11.6-alpine
ports:
- "5432:5432"
environment:
- POSTGRES_DB=my_db
- POSTGRES_PASSWORD=changeme
command:
- "postgres"
- "-c"
- "wal_level=logical"
或者
command: [ "postgres", "-c", "wal_level=logical" ]
如果您喜欢这种格式。