Docker Community Forums

Share and learn in the Docker community.

NFS Volume connection refused

Hello to everybody,

I’m working with NFS Volume.
I created a NFS server and on my rasberry pi I set the client and if I mount the directory exposed I can see the content, It’s mean that the configuration works.

My goal is to create a volume with the following command:

 sudo docker volume create --driver local \
    --opt type=nfs \
    --opt o=addr=,rw \
    --opt device=:/export/users/reddata \

As I saw in the documentation the create a NFS volume.
My problem is the follow, when I run the container:

sudo docker run -it -p 1880:1880 -v foo:/data --name mynodered -d nodered/node-red

I receive the following error:

docker: Error response from daemon: failed to mount local volume: mount :/export/users/reddata:/var/lib/docker/volumes/foo/_data, data: addr= connection refused.
See 'docker run --help'.

I this that something it’s not authorized, but I also think that I can mount my shared directory on my pi the configuration previous did should works.

Do you have any idea?

Thanks for your time


It is a good practice to try a mount on the shell first.If it succeeds, create your volume.

It seems like your host is not allowed to accees the exported nfs-share. On the nfs server, make sure that the ip or ip range of your docker host is listed in /etc/exports.

Hello meyay,

Thanks a lot to join.
I tried to mount the directory directly on the filesystem and works, But when I try with docker I receive the error.
My /etc/exports it the follow:

/export/users/reddata *(rw,sync,no_subtree_check,insecure)

to allow all IP.

Thanks a lot for the answer.


Ah okay, you have a wildcard for allowed host.

Now lets check if the behavior is the same with a container without restricted user:
sudo docker run -it --rm --name nfs-test -v foo:/data alpine sh

If this doesn’t work, try to use o=addr= when creating the volume instead of o=addr=,rw.

Make sure to use nfsv4 or v4.1 if you want to have a consitant good experience with docker and nfs shares. Eventually nfs3 will make you unhappy in this context. If you use nfsv4 try o=addr=,nfsvers=4

Hello meyay,

Yessssss it has worked, you solved my problem.
I created the volume in this way, as you have suggested:

sudo docker volume create --driver local
–opt type=nfs
–opt o=addr=,nfsvers=4
–opt device=:/export/users/reddata

I want to congratulate you on the idea of ​​using Alpine to sh the container.

Thanks a lot.
Take care.