I am working on a Web-App which needs access to a QNAP-NAS file system to edit and create directories and files inside it.
In order to mount the NFS to the docker container, I used the following docker compose file:
services:
app:
... # Irrelevant stuff
volumes:
- .:/app
- "nfs-base:/base" # Mount the nfs volume to the /data directory in the container
volumes:
nfs-base:
driver: local
driver_opts:
type: nfs
o: "nfsvers=4,addr=IPADDRESS_OF_THE_QNAP-NAS,rw"
device: ":/"
And I can’t access the files inside the container directory. Here is what I tried:
In the device
field, I was using ":/base"
(which is the directory of the qnap-nas filesystem which I want to mount), but then I was getting the error :
Error response from daemon: error while mounting volume '/var/lib/docker/volumes/so-webapp_nfs-base/_data': failed to mount local volume: mount :/base:/var/lib/docker/volumes/so-webapp_nfs-base/_data, data: nfsvers=4,addr=192.168.16.202: operation not permitted
I changed the device
field to ":/"
and I get no error when creating the volume, but the problem comes when I enter to the container content to review if the files are properly mounted, since when I access to the mounted directory inside the container, I get the error: bash: cd: base/base: Operation not permitted
.
It seems that there is a permission thing to solve, but the /etc/exports file in the QNAP-NAS has the rw
permission on the folder for all users.
I would strongly appreciate if someone knows how to solve this issue.
Thanks in advanced!
JoanAcero is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.