Skip to content
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

Postgres changing permissions failes #22

Open
benji4398 opened this issue Aug 1, 2022 · 2 comments
Open

Postgres changing permissions failes #22

benji4398 opened this issue Aug 1, 2022 · 2 comments

Comments

@benji4398
Copy link

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
Copy link
Member

triole commented Aug 4, 2022

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
Copy link

johlton commented Aug 8, 2022

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants