我的docker引擎在Ubuntu 16上运行。
我尝试根据以下方式设置NFS服务器:使用https://github.com/ErezHorev/dockerized_nfs_server/blob/master/docker/Dockerfile
NFS服务器现在正在运行。容器IP是172.17.0.2
但我无法安装在同一个容器或其他容器中。
错误:
root@71d5a4bc32bc:/# mount -v -t nfs -o proto=tcp,port=2049 172.17.0.2:/exports/opt /mnt
mount.nfs: timeout set for Tue Aug 9 13:06:36 2016
mount.nfs: trying text-based options 'proto=tcp,port=2049,vers=4,addr=172.17.0.2,clientaddr=172.17.0.2'
mount.nfs: mount(2): Operation not permitted
mount.nfs: trying text-based options 'proto=tcp,port=2049,addr=172.17.0.2'
mount.nfs: prog 100005, trying vers=3, prot=6
mount.nfs: portmap query failed: RPC: Program not registered
**mount.nfs: requested NFS version or transport protocol is not supported**
调试
root@71d5a4bc32bc:/# rpcinfo
program version netid address service owner
100000 4 tcp6 ::.0.111 portmapper superuser
100000 3 tcp6 ::.0.111 portmapper superuser
100000 4 udp6 ::.0.111 portmapper superuser
100000 3 udp6 ::.0.111 portmapper superuser
100000 4 tcp 0.0.0.0.0.111 portmapper superuser
100000 3 tcp 0.0.0.0.0.111 portmapper superuser
100000 2 tcp 0.0.0.0.0.111 portmapper superuser
100000 4 udp 0.0.0.0.0.111 portmapper superuser
100000 3 udp 0.0.0.0.0.111 portmapper superuser
100000 2 udp 0.0.0.0.0.111 portmapper superuser
100000 4 local /run/rpcbind.sock portmapper superuser
100000 3 local /run/rpcbind.sock portmapper superuser
100024 1 udp 0.0.0.0.146.187 status 102
100024 1 tcp 0.0.0.0.225.53 status 102
100024 1 udp6 ::.221.215 status 102
100024 1 tcp6 ::.237.126 status 102
root@71d5a4bc32bc:/# rpcinfo -p 172.17.0.2
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100024 1 udp 37563 status
100024 1 tcp 57653 status
root @ 71d5a4bc32bc:/#showmount -e 172.17.0.2 clnt_create:RPC:程序未注册
修改
我跑的时候
service nfs-kernel-server start
mount: permission denied
* Exporting directories for NFS kernel daemon...
exportfs: could not open /proc/fs/nfs/exports for locking: errno 13 (Permission denied)
[ OK ]
* Starting NFS kernel daemon rpc.nfsd: Unable to access /proc/fs/nfsd errno 2 (No such file or directory).
Please try, as root, 'mount -t nfsd nfsd /proc/fs/nfsd' and then restart rpc.nfsd to correct the problem
2049港口从未上过。