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?
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"]
Most helpful comment
Another option is to redefine the CMD in your Dockerfile. The original one is
but you can add configuration options, e.g.,