I created an NFS volume and was able to successfully use it on Ubuntu 16.04. However when I move my image to SLES-12 and try to run it I get the error:
user@localhost:~> docker run -it -v nfs_test02:/mnt/nfs nfs_tests bash
docker: Error response from daemon: chown /var/lib/docker/volumes/nfs_test02/_data: invalid argument.
The Dockerfile for the nfs_tests container has the command:
USER nfs_testuser01
I create the nfs_testuser01 with specific UID/GID (both 1000).
If I run the container and create a volume from a local directory, e.g.:
user@localhost:~> docker run -it -v /var/tmp/test_dir:/test nfs_tests bash
It works fine. So there’s something about the NFS volume on SLES-12 that’s causing a problem. Has anyone else seen this?
If I mount the NFS export on a local directory and then specify the volume like a normal local directory for the run command, then I can access it just fine.
The syntax is correct. Usualy if a NFS mount can be mounted from the CLI, it should work as docker volume mount as well. The behavior is odd. Can you try nfsvers=3 instead of vers=3?
Also NFS version 4 or 4.1 is recommended over 3. Usualy version 3 tends to cause problems.
If this doesn’t help. Since Docker Inc does not provide Docker CE package for SLES, your installation must be an os vendors package (as in: likely customized, repackaged and redistributed by SUSE), as such I would suggest to raise an issue to the os vendor.
I’m stuck with NFS v3 due to the server implementation. For now the work-around of mounting it locally seems to be fine. It’s not the best solution, but…
I think I figured it out. Since I’m using a non-root user in the container I needed to chown the mount point for the NFS export so that it already belonged to the user. So I now do that in the Dockerfile and that seems to have fixed the problem.