portainer: Unable to mount an NFS volume

Bug description Ive got trouble with mounting an NFS share as a volume for a container. Strangely it worked once until a restart, but i was not able to repeat it.

Im running my Portainer on a VMWare Photon host. One of the shared NFS folders on my OMV server is accessible from whole subnet and has full r/w access permissions for user “docker” with uid 1003. I have set up Portainer to use NFS4 and added PUID=1003 to the containers runtime options, but whenever i want to create a container using the volume im getting an error: error while mounting volume '/var/lib/docker/volumes/calibre-web-data/_data: failed to mount local volume: mount :/export/Ebooks:/var/lib/docker/volumes/calibre-web-data/_data, flags 0x400, data:addr=10.10.1.13, rsize=8192,wsize=8192,tcp,timeo=14: no such file or directory When i run showmount -e 10.10.1.13 on the docker host i get: /export/Ebooks 10.10.0.0/16 the share is mountable on both my desktop and docker host (manually).

~$ mount | grep Ebooks
10.10.1.13:/Ebooks on /DATA-OMV/Ebooks type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.10.10.10,local_lock=none,addr=10.10.1.13)

Here are my volume’s settings Screenshot from 2020-05-01 21-01-51

Expected behavior Container should start with an NFS volume mounted

Portainer Logs No logs, as i cannot run the container.

Technical details:

  • Portainer version: 1.23.2
  • Docker version (managed by Portainer): Docker version 18.09.9, build 039a7df
  • Platform (windows/linux): Linux r720-photon 4.19.115-1.ph3-esx #1-photon SMP Tue Apr 21 18:54:09 UTC 2020 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (8 by maintainers)

Most upvoted comments

I’m aware this is an “old” closed thread, but it’s one of the top/only results when searching for portainer and NFS volume issues. I cannot get this to work using TrueNAS scale’s NFS implementation and portainer running in an Ubuntu server VM. I keep getting invalid argument when trying to mount the volumes. Of course, portainer happily creates volumes with whatever arguments passed as it’s not actually trying to mount the NFS volume upon volume creation. So when trying to start containers based upon a stack, errors appear if the volume mounts don’t work. After a a full day of frustration, I found that the uid and gid options were causing the "invalid argument "errors. I got things to work by NOT passing uid= and gid= in the option string, just leaving the defaults. First step was to create my storage datasets in TrueNAS. Then create the appropriate user and group as TrueNAS local users/groups with the UID and GID I want. Then applied the permissions to the datasets - recursively. Then you can create the NFS share - no need for mapall/maproot settings- you are syncing uids/gids. Build the docker server VM with the system user having matching UID/GID (required rebuilding the user/group to match) Confirm you can mount the NFS shares on the docker host VM using the CLI and a standard mount command (mount x.x.x.x.:/alias /mnt/mountpoint) - just a test, unmount before proceeding Then create the volumes in portainer without the uid/gid options Build your stack script/docker compose with the volume labels at the top level (using external:true) and mapped in the container specification to the appropriate internal container directories Fun.

What could be causing this error? I’m having the same issue with TrueNAS NFS and Portainer.

I don’t think this is an error. I tried to get its working for +12h, did not under stand the problem.

But then i found a video from Portainer taking about “How-to: Use the Portainer volume browser feature” Last in this video he talks about NFS Volumes and Portainer. Then he mentions that the NFS volume is not mounted IF not the Volume is associated with a container AND it is running. As soon as the container stops the NFS are no longer mounted.

I went back to documentation and can’t find any thing about it, under “Volumes”. Had been nice if it had been mentions there, how it’s working. For I thought it was mounted the whole time, as soon I had created the volume with NFS mount.

So everything have been working right for me the hole time.