Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 767
Rafael Costa Avatar asked Dec 19 '19 20:12

Rafael Costa


1 Answers

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.

like image 171
Miles Elam Avatar answered Sep 20 '22 07:09

Miles Elam