rdmorganiser / rdmo-docker-compose

RDMO running in different docker images held together by docker compose
Apache License 2.0
3 stars 13 forks source link

Postgres changing permissions failes #22

Closed benji4398 closed 2 months ago

benji4398 commented 2 years ago

Hi! After fixing the issue #21 the postgres container fails with

initdb: error: could not change permissions of directory "/var/lib/postgresql/data": Operation not permitted

After removing the ARG UID, RUN chown -R ${UID} /var/lib/postgresql and USER ${UID} statements in the posgres Dockerfile and commenting out the args: UID: <LOCAL_UID> statement in the dc_master.yaml the postgres container starts.

As far as I know, the postgres image runs as the postgres user per default, so changing the user and permissions seems unnecessary here. If required, maybe run an Ubuntu image and install postgres during build? might also fix issue #21.

triole commented 2 years ago

Hi, i know that changing the permissions of the folder seems unnecessary. This is why we did not have it for a long time.

But the idea behind doing it now is trying to avoid having issues with file permissions inside the vol/postgres folder on the host. I am not sure why your postgres container does not come up because mine does. Although I had the warning that changing the permissions failed the container did start as it should. This may have to do with the way by whom the files inside the vol/postgres folder on your host are owned.

If the owner is the user that runs and builds the docker containers, as it should be due to the newly introduced changes the permissions warning shouldn't even occure when starting the postgres container because they are set correctly during the docker build.

Anyway I pushed a few tiny modifications. Maybe they'll help. If not we'll need to continue investigating.

Thanks for checking out. Cheers.

johlton commented 2 years ago

Hi,

i made the suggested changes by @benji4398 on docker/postgres/Dockerfile and dc_master.yaml, there is no permission error coming up, but the container still refuses to start:

find: ‘postgres’ is not the name of a known user

Is there a configuration somewhere assuming to have Postgres installed on the host system as well?

I also reassigned ownership of the /vol/postgres dir from systemd-coredump (I mentioned this behaviour in #21) to my current user id but that did not bring anything.

(This happens on Ubuntu 20 and above, as I forgot to mention this in my opening post)

Thanks for checking!