sjiveson / nfs-server-alpine

A handy Alpine Linux based NFS Server image running NFS v4 only, over TCP on port 2049
https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/
GNU General Public License v3.0
295 stars 187 forks source link

connection refused when connecting the nfs server #21

Closed pomelio closed 6 years ago

pomelio commented 6 years ago

The problem is the client side can not mount the server. The error message is 'connection refused'

OS: Mac IP Address: 192.168.1.88

the nfs server running with the following output:

JAYs-MacBook-Air:nfs jay$ docker start -a nfs The PERMITTED environment variable is missing or null, defaulting to '*'. Any client can mount. The READ_ONLY environment variable is missing or null, defaulting to 'rw' Clients have read/write access. The SYNC environment variable is missing or null, defaulting to 'async'. Writes will not be immediately written to disk. Starting Confd population of files... confd 0.14.0 (Git SHA: 9fab9634, Go Version: go1.9.1) 2018-10-22T11:42:43Z e9c787ebbd95 /usr/bin/confd[12]: INFO Backend set to env 2018-10-22T11:42:43Z e9c787ebbd95 /usr/bin/confd[12]: INFO Starting confd 2018-10-22T11:42:43Z e9c787ebbd95 /usr/bin/confd[12]: INFO Backend source(s) set to

Displaying /etc/exports contents... /share *(rw,fsid=0,async,no_subtree_check,no_auth_nlm,insecure,no_root_squash)

Starting rpcbind... Displaying rpcbind status... program version netid address service owner 100000 4 tcp6 ::.0.111 - superuser 100000 3 tcp6 ::.0.111 - superuser 100000 4 udp6 ::.0.111 - superuser 100000 3 udp6 ::.0.111 - superuser 100000 4 tcp 0.0.0.0.0.111 - superuser 100000 3 tcp 0.0.0.0.0.111 - superuser 100000 2 tcp 0.0.0.0.0.111 - superuser 100000 4 udp 0.0.0.0.0.111 - superuser 100000 3 udp 0.0.0.0.0.111 - superuser 100000 2 udp 0.0.0.0.0.111 - superuser 100000 4 local /var/run/rpcbind.sock - superuser 100000 3 local /var/run/rpcbind.sock - superuser Starting NFS in the background... rpc.nfsd: knfsd is currently down rpc.nfsd: Writing version string to kernel: -2 -3 +4 rpc.nfsd: Created AF_INET TCP socket. rpc.nfsd: Created AF_INET6 TCP socket. Exporting File System... exporting *:/share /share Starting Mountd in the background... Startup successful.

--------------------------------client------------------------------------------ The client side running on same mac machine with the following command:

JAYs-MacBook-Air:nfs jay$ mount -v 192.168.1.88:/share ./abc mount_nfs: can't mount /share from 192.168.1.88 onto /Users/jay/Desktop/bitbucket/dev/projects/appstore/server/swarm/nfs/abc: Connection refused

Thanks, Jay

pomelio commented 6 years ago

I am not sure the reason is because the docker container can not be started on port 111 which is reserved on Mac.

When you change to another port such as -p 5111:111 the problem is the mount command doesn't have an option to specify the rpc new port 5111

sjiveson commented 6 years ago

You don't need to expose the RPC port, RPC isn't used with NFSv4. Its only there to overcome a bug with slow start up. Have you exposed 2049/tcp?

caleno commented 6 years ago

Actually, I had to set privileged mode on my container (16.04.1-Ubuntu) to be able to mount the nfs share form the inside of Kubernetes.

          securityContext:
            privileged: true

Adding the SYS_ADMIN capability to the container mounting the nfs share didn't suffice, I got permission denied.

Also, since I ran this on the "inside network" I didn't have to expose the 2049 port.

sjiveson commented 6 years ago

OK, good stuff, I didn't realise you were using K8s. Luckily that detail is already in the README. Thanks for reporting back.

jaykishan007 commented 9 months ago

Facing the same issue, Did we have a solution yet? I don't know why this been closed @sjiveson @caleno @pomelio .

I am running this as a stand alone container, facing the same problem and yes the privileged: true.