I can run docker run ... as a non-root user (let’s call it pg) and it works, but the issue is something like this:
docker run -d -v /home/pg/pg/:/var/lib/postgresql/data/ postgres
This creates a directory for volume like this:
drwx------ 19 70 root 4096 Jun 19 20:53 pg/
in which case, the pg user cannot access to /home/pg/pg directory:
pg@server:/home/pg/$ ll pg/
ls: cannot open directory 'pg/': Permission denied
I need this because I created a new user for pg and I told developer to use this user instead of root.
Besides granting sudo access to pg (which makes no sense for creating different users for different projects) or even chowning the directory to pg:pg, are there any other ways?
>Solution :
are there any other ways?
Give access to others to the dir.
chmod 777 /home/pg/pg