Skip to content

get '/var/run/postgresql': Operation not permitted with arbitrary --user #853

Closed
@ise-tang

Description

@ise-tang

Hi.

I try to run the postgres container with an arbitrary user.
When that, I get chmod: changing permissions of '/var/run/postgresql': Operation not permitted
Is that right working? If not, What Can I do to fix?

Host: macOS 11.4
Vagrant : 2.2.16
VM box: ubuntu/groovy64

I do below

vagrant@lvh:~$ docker volume create pgdata
pgdata
vagrant@lvh:~$ docker run -it --rm -v pgdata:/var/lib/postgresql/data -e POSTGRES_PASSWORD=mysecretpassword postgres
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.utf8".
...

vagrant@lvh:~$ docker run -it --rm -v pgdata:/var/lib/postgresql/data bash chown -R 1000:1000 /var/lib/postgresql/data
vagrant@lvh:~$ docker run -it --rm --user 1000:1000 -v pgdata:/var/lib/postgresql/data postgres
chmod: changing permissions of '/var/run/postgresql': Operation not permitted # <== Is this right ?

PostgreSQL Database directory appears to contain a database; Skipping initialization

2021-06-03 00:26:42.378 UTC [1] LOG:  starting PostgreSQL 13.3 (Debian 13.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
2021-06-03 00:26:42.379 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionUsability question, not directly related to an error with the image

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions