-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to allow custom commands during startup. #1059
Comments
I propose something like: "Run files in folder /docker-entrypoint-initdb.d/always/* regardless if database has been initalized." As this is done before the postgres instance is started, the group ID should be changed and postgres will not fail to read SSL private key for me. I guess this can be useful for other cases aswell, if people need to modify the docker container logic, before start of the postgres itself. Ofcourse the folder can be something else that /always/ |
There seems to be a caveat right now: I tried to add these lines to docker-entrypoint.sh through ansible.
But I found out that because the user who runs the docker container is 1000:1000 does not have root access inside the container to change these permissions.
|
If you want a solution that does something with a started database (like our existing initdb scripts do), see #173, #821, #191, #929 for some other issues that have some good thoughts / suggestions. However, it looks like you just want "something" to run before PostgreSQL starts, which is a much easier ask -- you'll want to set your container's "command" to something like If the directory you're doing this to is a bind-mount, you could also do those modifications on the host directory before mounting it (and the container shouldn't touch them), or if they're image-only you might consider having a short |
Thank you for the response. In the end I changed the ssl-cert group in the host to match the GID of the 'user' that runs the docker container.
The docker-compose ended up looking like this.
Now the SSL certs are read by postgresql.conf options. |
Is there a possiblity to add custom commands on startup?
I am battling the godforbidden riddance of permission rights for certificates. As I have an external cert I wish to mount to use TLS encryption. The problem is that the cert has root:ssl-cert rights, but the host and postgres container differ in the GID.
I wish to do
groupmod -g GID_THAT_IS_IN_HOST ssl-cert
. So when I mount the private key with permissions 640 that the postgres user can read the file inside the container.As the docker-entrypoint logic is only run during initalization, when there is no pgdata, on restarts this does not persist.
The text was updated successfully, but these errors were encountered: