Reputation: 3181
I'm trying to override a single item in the Postgres
configuration of the official Docker
Postgres
image. Namely, I want to override the log_statement
property and set it to all
.
Tried it with:
docker run -d -e POSTGRES_PASSWORD=postgres postgres -c 'log_statement=all'
After enter the docker container and execute:
cat /var/lib/postgresql/data/postgresql.conf | grep log_statement
is still get the default value which is none
.
but without success.
There are a few answers/questions regarding Postgres
Docker
configuration but they suggest replacing the complete postgresql.conf
file.
Upvotes: 1
Views: 1474
Reputation: 4701
From the docs:
Command-line options override any conflicting settings in postgresql.conf. Note that this means you won't be able to change the value on-the-fly by editing postgresql.conf, so while the command-line method might be convenient, it can cost you flexibility later.
As far as I understand that doesn't change the postgresql.conf
but it actually runs the postgres
command with the desired options. That's probably why you don't see the value set to all
in the configuration file.
Hope it helps.
Upvotes: 1
Reputation: 1004
I test your question in my pc.
In the postgresql.conf
log_statement="none"
is commented.
Go manually and discomment it and it solve your problems.
docker exec -it postgres bash
Into the container:
apt update
apt install vim
vim /var/lib/postgresql/data/postgresql.conf
That is my solution.
Upvotes: 0
Reputation: 1493
My solution is to mount Postgres config file somewhere on the server and edit it.
Upvotes: 0