Postgres: What is the recommended way to configure postgres?

Created on 4 Apr 2016  路  4Comments  路  Source: docker-library/postgres

I am putting my local overrides in a file postgres.conf.local and then doing something like this:

RUN { echo; echo "include '/local/postgresql.conf.local'"; } >> "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample"
COPY postgresql.conf.local /local

Is it how I am supposed to do it?

Most helpful comment

Another option is to redefine the CMD in your Dockerfile. The original one is

CMD ["postgres"]

but you can add configuration options, e.g.,

CMD ["postgres", \
     "-c", "logging_collector=on", \
     "-c", "log_destination=csvlog"]

All 4 comments

That should be fine. I do it like this:

COPY postgresql.conf /usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample

When initdb is called by docker-entrypoint.sh, the config is copied into the $PGDATA directory.

@evoyy It doesn't work for me for postgres 9.5 image, nothing is copied.

Actually it works, but for some reason postgresql shows "selecting default max_connections ... 100" instead of 200 min connections I've selected. SHOW ALL query shows correct config.

Another option is to redefine the CMD in your Dockerfile. The original one is

CMD ["postgres"]

but you can add configuration options, e.g.,

CMD ["postgres", \
     "-c", "logging_collector=on", \
     "-c", "log_destination=csvlog"]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

roks0n picture roks0n  路  4Comments

phanikumarp picture phanikumarp  路  3Comments

jiffingomez picture jiffingomez  路  4Comments

mcnesium picture mcnesium  路  3Comments

note89 picture note89  路  3Comments