Closed ghevge closed 1 year ago
/var/lib/postgresql/data/
is a volume, so nothing can be saved there during image build, but that is the location for the config file generated by PostgreSQL's initdb
and is used by default. It is generated from the /usr/local/share/postgresql/postgresql.conf.sample
file (which we adjust for the images). You can replace that .sample
and your custom config "sample" would be used to generate the .conf
at first runtime. Or you can provide a full .conf
anywhere (readable by postgres
user) in the image and add -c 'config_file=/etc/postgresql/postgresql.conf'
to a custom CMD
# untested, but this *should* work
FROM postgres:15-alpine
COPY --chown postgres:postgres ./postgresql.conf /etc/postgresql.conf
CMD [ "-c", "config_file=/etc/postgresql/postgresql.conf" ]
Thanks for clarifying this!
/var/lib/postgresql/data/
is a volume, so nothing can be saved there during image build, but that is the location for the config file generated by PostgreSQL'sinitdb
and is used by default. It is generated from the/usr/local/share/postgresql/postgresql.conf.sample
file (which we adjust for the images). You can replace that.sample
and your custom config "sample" would be used to generate the.conf
at first runtime. Or you can provide a full.conf
anywhere (readable bypostgres
user) in the image and add-c 'config_file=/etc/postgresql/postgresql.conf'
to a customCMD
# untested, but this *should* work FROM postgres:15-alpine COPY --chown postgres:postgres ./postgresql.conf /etc/postgresql.conf CMD [ "-c", "config_file=/etc/postgresql/postgresql.conf" ]
Minor correction:
COPY --chown=postgres:postgres ./postgresql.conf /etc/postgresql.conf
CMD [ "-c", "config_file=/etc/postgresql.conf" ]
How can I override the postgresql.conf ? In my Dockerfile I've tried the following:
Non of these approaches is changing the default configurations
I'm playing with postgres:15-alpine image.
Thanks