mounting nfs volume errors out

89 Views Asked by At

From my docker host terminal, I am trying to mount an nfs shared folder of a raspberry pi installed with OpenMediaVault. The below command fails with message - "mount.nfs: mounting 192.168.142.123:/export/nfs/docker/volume/myapp failed, reason given by server: No such file or directory".

mount -t nfs -o nfsvers=4 192.168.142.123:/export/myapp /var/lib/docker/volumes/myapp/_data

In Pi, in OMV, I have checked and ensured that a shared folder is created and in OMV --> Services --> NFS --> Shares, I see it as myapp [on dev/sda1, export/nfs/docker/volume/myapp/] with due permissions for NFS client IPs. Again, the /etc/exports file has the entry

/export/mysqldb 192.168.142.0/24(fsid=<some ID>,rw,subtree_check,insecure)

Also, the output of the lsblk -f shows -->

NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda                                                                                 
└─sda1      ext4   1.0          <some UUID>                          400.4G     0% /export/myapp

I just tried doing a file copy from docker host to nfs host which worked just fine...

scp test.txt 192.168.142.123:/export/nfs/docker/volume/myapp/

Where am I going wrong with the docker mount ? Help much appreciated...

1

There are 1 best solutions below

0
VonC On

The path /export/nfs/docker/volume/myapp/ is the actual shared folder on your Raspberry Pi that you have set up in OpenMediaVault (OMV). That is the directory that you are sharing over the network via NFS.
The path /export/myapp mentioned in your lsblk -f output seems to be a local directory on your Raspberry Pi. It is not clear if this is the same as /export/nfs/docker/volume/myapp/ or a different directory.

Check that the NFS export path in /etc/exports matches the actual directory structure of your shared folder. In your case, it should be /export/nfs/docker/volume/myapp/ ('/export/...'not "export/..." as in OMV --> Services --> NFS --> Shares, myapp [on dev/sda1, export/nfs/docker/volume/myapp/]).

Modify the /etc/exports file on the Raspberry Pi to correctly point to the shared folder. The entry should be like:

/export/nfs/docker/volume/myapp/ 192.168.142.0/24(fsid=<some ID>,rw,subtree_check,insecure)

Make sure the mount command on your Docker host matches the exported path. Based on your description, the correct mount command would be:

mount -t nfs -o nfsvers=4 192.168.142.123:/export/nfs/docker/volume/myapp /var/lib/docker/volumes/myapp/_data

You should get:

 Docker Host                          Raspberry Pi (OpenMediaVault)
+-------------------+               +---------------------------------+
|                   |               |                                 |
|   /var/lib/docker |               |   /export/nfs/docker/volume     |
|   /volumes/myapp  |  NFS Mount    |   /myapp                        |
|   /_data          | <------------>|   (Shared Folder)               |
|                   |               |                                 |
+-------------------+               +---------------------------------+