简体   繁体   中英

How to change postgres docker image wal level on setup?

I am using the postgres:11.6-alpine image for one of my applications and I would like to set the image wal_level to 'logical' on setup, preferably using docker-compose.

The solutions I found needs you to overwrite the image postgresql.conf. However I dont want to have a full postgresql.conf file just to change this setting.

Is there any way I can do this?

Update the command portion of your PostgreSQL container configuration like so.

services:
  postgres:
    image: postgres:11.6-alpine
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=my_db
      - POSTGRES_PASSWORD=changeme
    command:
      - "postgres"
      - "-c"
      - "wal_level=logical"

Or

    command: [ "postgres", "-c", "wal_level=logical" ]

If you prefer that formatting.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM