Closed
Description
This container is rather handy but I've found it more difficult than I expected to apply a non-default configuration. Specifically I needed to install SSL certificates and keys, apply some postgresql.conf
entries and modify pg_hba.conf
.
To do so I had to create a setup script in /docker-entrypoint-initdb.d/
to overwrite pg_hba.conf
, append to postgresql.conf
and copy the SSL certs in from a bind mounted volume. Originally I actually went further and made a derived container that copied these things in before I realised I could just bind mount.
I suggest:
- document that bind-mounting
/docker-entrypoint-initdb.d/
is a good way to run scripts and load configuration; - Special case a
/docker-entrypoint-initdb.d/copy-files.d/
directory. When present, copy everything incopy-files.d
to the new datadir (recursively, preserving mode and changing ownership to container user). So you can add an include_dir etc. - Special case a
/docker-entrypoint-initdb.d/append-files.d/
directory. When present, append everything inappend-files.d
to the new datadir with the same filename, creating it if it doesn't exist. - Auto-append
include_dir 'postgresql.conf.d'
to the generatedpostgresql.conf
. Document that any config file snippet placed in/docker-entrypoint-initdb.d/copy-files.d/postgresql.conf.d/
will be copied to the datadir and loaded as part of PostgreSQL's configuration. Or alternately just special casepostgresql.conf.d
in thedocker-entrypoint-initdb.d
and auto-enableinclude_dir
if it's present. - Make it more obvious in the docs that scripts in
/docker-entrypoint-initdb.d/
run as the postgres user.