Skip to content

No permissions to delete /var/lib/postgresql/data #32

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

Closed
daGrevis opened this issue Nov 12, 2014 · 2 comments
Closed

No permissions to delete /var/lib/postgresql/data #32

daGrevis opened this issue Nov 12, 2014 · 2 comments

Comments

@daGrevis
Copy link

This is how I run Postgres container:

docker run -d \
           -v /etc/fxz/postgres:/var/lib/postgresql/data \
           -e LC_ALL=C.UTF-8 \
           -p 5432:5432 \
           --name=postgres \
           postgres

I can see created directory:

$ ls -l /etc/fxz/
drwx------ 15  999 root 4096 Nov 12 10:59 postgres

But the problem is that I have no permissions to delete it:

$ rm -rf /etc/fxz/postgres/
rm: cannot remove '/etc/fxz/postgres/': Permission denied

If I do it as root, it works.

Are there any way to delete it as non-root user? I am in docker group already.

@yosifkit
Copy link
Member

The problem here arises from user permissions; the files in the mounted volume get chowned to the postgres user of the container by the entrypoint script (which happens to be 999) so that postgres can access the data. So, no there is no way to give your user permission to the files.

@daGrevis
Copy link
Author

The hack is strong with this one.

docker run --rm -v /etc/fxz:/etc/fxz postgres /bin/bash -c 'rm -rf /etc/fxz/postgres'

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

2 participants