Docker Community Forums

Share and learn in the Docker community.

NFS and Write Permission


(Rollinroy) #1

Sorry in advance for the rather long post, but it’s a rather complicated issue …

Basic problem: I’m running a docker image based on Ubuntu 16.04 on macOS (10.13.3) where I bind mount a previously mounted NFS volume with the -v option (I previously mounted the NFS volume via sudo mount_nfs from macOS terminal window). Running as root in the docker image, I can read any of the files; however when I attempt to write a file to the NFS volume I get “Permission Denied”.

Work around: From macOS terminal, if I change the permission to 777 for desired folders and files, I can then have write access to the NFS volume from the docker image. See Other information below where I do not see this behavior running the same docker image on Ubuntu.

Specifications include:

  1. Docker version: 17.12.0-ce-mac55 (23011)
  2. macOS version: 10.13.3
  3. docker run command: docker run --rm -it -v /nfs_vol:/nfs_vol /
  4. On mac, enabled file sharing on the mounted volume via docker->preferences …
  5. The NFS server has been configured to export the data with the no_root_squash option

NFS mount command from macOS: sudo mount_nfs -v -o vers=4 /export_vol /nfs_vol

Other information:
1 From a computer running ubuntu on AWS, I can mount the same volume and execute the same docker command (i.e., docker run --rm -it -v …) without any permission problems
2 On the docker Ubuntu image, I created an account with the same UID and GID but the root account on mac could still not write to the NFS volume