Docker Community Forums

Share and learn in the Docker community.

Changed permissions of volume: You don't have permission to access this resource

I am running an instance of nextcloudpi in docker. I wanted to sync the data folder between two server via rsync, but got a permission folder. So I tried to give my user “John” the permission to read the folder. It seems I did something wrong as know the instance cannot access the data folder and in the browser when trying to access nextcloud, I get “You don’t have permission to access this resource.”
Can someone please tell me how to fix this? What should the permissions in the folder are? Right know, I have the following permissions:

$:/var/lib/docker$ sudo ls -l
drwx--x--x 4 root root 8 Mai 28 20:09 buildkit
drwx------ 3 root root 3 Jun 17 18:25 containers
drwx------ 3 root root 3 Mai 28 20:09 image
drwxr-x--- 3 root root 3 Mai 28 20:09 network
drwx------ 4 root root 4 Mai 28 20:09 plugins
drwx------ 2 root root 2 Jul  2 17:14 runtimes
drwx------ 2 root root 2 Mai 28 20:09 swarm
drwx------ 2 root root 2 Jul  2 17:14 tmp
drwx------ 2 root root 2 Mai 28 20:09 trust
drwxr--r-- 3 root root 5 Jul  2 17:14 volumes
drwx------ 3 root root 3 Mai 28 20:10 zfs

$ sudo ls -l volumes
total 7
brw------- 1 root root 0, 64 Jul  2 17:14 backingFsBlockDev
-rwxr--r-- 1 root root 32768 Jul  2 17:14 metadata.db
drwxr--r-- 3 root root     3 Mai 28 20:11 ncdata

Some permission look different then on my system:


me@swarm1:~# ls -l /var/lib/docker
total 36
drwx------   2 root root    24 Sep 11  2019 builder
drwx--x--x   4 root root   139 Dec 12  2020 buildkit
drwx-----x  17 root root  4096 Jun 29 21:45 containers
drwx------   3 root root    22 Sep 11  2019 image
drwxr-x---   3 root root    19 Sep 11  2019 network
drwx-----x 191 root root 24576 Jun 29 21:45 overlay2
drwx------   4 root root    32 Sep 11  2019 plugins
drwx------   2 root root     6 Apr 17 09:12 runtimes
drwx------   5 root root    95 Jun 29 19:28 swarm
drwx------   2 root root     6 Jun 29 21:45 tmp
drwx------   2 root root     6 Sep 11  2019 trust
drwx-----x  14 root root  4096 Jun 29 19:31 volumes

The /var/lib/docker/volumes/* folders have a 0755 permission mask, with 0:0 as owner
The folder _data inside each volume folder has a 0755 permission mask, with 0:0 as owner
The file opts.json inside each volume folder has a 0110 permission mask, with 0:0 as owner

Whatever you do, make sure to apply the permissions on folder/file level one by one and do not use recursive operation, as this will high likely break something else.