I can see the shares of the server:

[root@sandbox /]# showmount -e
Export list for
/RAIDPOOL02/vers     *
/RAIDPOOL02/prod     *
/RAIDPOOL02/pipeline *

When I attempt to mount, I get this:

[root@sandbox /]# mkdir -p /
[root@sandbox /]# mount --verbose --options=nolock,exec,soft,intr,uid=500,rsize=65536,wsize=65536 /

mount.nfs: timeout set for Wed May  4 08:16:49 2016
mount.nfs: trying text-based options 'nolock,soft,intr,uid=500,rsize=65536,wsize=65536,vers=4,addr=,clientaddr='
mount.nfs: mount(2): Operation not permitted
mount.nfs: trying text-based options 'nolock,soft,intr,uid=500,rsize=65536,wsize=65536,addr='
mount.nfs: prog 100003, trying vers=3, prot=6
mount.nfs: trying prog 100003 vers 3 prot TCP port 2049
mount.nfs: prog 100005, trying vers=3, prot=17
mount.nfs: trying prog 100005 vers 3 prot UDP port 20048
mount.nfs: mount(2): Operation not permitted
mount.nfs: Operation not permitted

I'm exposing these ports in my Dockerfile:

EXPOSE 20048

And I can successfully nmap port 2049 of the server:

[root@sandbox /]# nmap -p 2049

Starting Nmap 6.40 ( http://nmap.org ) at 2016-05-04 08:21 UTC
Nmap scan report for
Host is up (0.00061s latency).
2049/tcp open  nfs

Why am I getting "Operation not permitted"?


You probably need to run your containers in privileged mode:

docker run --privileged=true

If you can upgrade docker to 17.06, you can mount a NFS share directly, without extra capabilities:

docker run --mount 'type=volume,src=src_name,volume-driver=local,dst=/mnt,volume-opt=type=nfs,volume-opt=device=:/nfs-share,"volume-opt=o=nfs-server,vers=4,hard,timeo=600,rsize=1048576,wsize=1048576,retrans=2"' -d -it --name mycontainer ubuntu

Got the hint from the discussion here: https://github.com/moby/moby/issues/28809


I see a couple missing parts. NFS also requires port 111.

You excluded your "docker run" statement so I'm assuming you didn't have a -p switch for port 111. If you're not redirecting ports, the port section of your "docker run" statement should look something like "-p 111:111 -p 2049:2049 -p 20048:20048" (without the quotes).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.