I have an Ubuntu server VM running on a Windows 10 host, where a folder on an external hard drive is passed through to the VM at the mountpoint /NextCloudStorage. I can access this folder from my normal user, and from root, by adding my normal user to the vboxsf user group.
My Docker Compose file includes this to pass through the /NextCloudStorage to the container:
volumes:
- nextcloud:/var/www/html
- .:/code
- /NextCloudStorage:/NextCloudStorage
When using docker exec -it nextcloud-app-1 bash
, I can interact with the shared folder live using commands such as cd /NextCloudStorage
, mkdir test1
, etc.
My problem is that the application running in the container cannot access this folder, because it runs as www-data
. ls
commands list the folder as empty, and when trying to create an item in the folder I get the error "permission denied"
.
Does anyone know how to give the www-data
user access to this shared folder?
Sorry for the long post but I had to spiel it out!
Thanks!
You could try to add the www-data
user to the vboxsf
group
To achieve this we need to figure out the group id. In the virtual machine run
cat /etc/group
You will see something like this
Then in your container
, if this group doesnt exist create it
In this case the gid
we need to use is 115
groupadd --gid 115 vboxsf
Next add this group to your www-data user
usermod -aG vboxsf www-data
Update: Try to run the following command as root in the container
chmod -R 777 /NextCloudStorage