Description
Currently, the init script changes the ownership of /var/lib/postgresql/data
to make sure the postgres user can write to it's data directory.
However, when starting a postgres container, I use a data volume that shares both /var/lib/postgresql/data
for storing the data, and /var/run/postgresql
for storing the postgres sockets - so I don't have to use networking. The containers that need access to postgres are started with mounting my data volume and accessing (what they think is) the local unix socket. This way can easily give another container access to my postgres database without network discovery or network overhead, eliminating a lot of potential problems and improving security.
The problem however is that when you create a volume like this, I have to launch a temporary container to fix the permissions of /var/run/postgresql
before launching my postgres server.