[SOLVED] Problems creating NFS volume from command line

Running docker on Ubuntu Server 22.04 using the docker installed from the Ubuntu repos.

I can create NFS4 volumes in portainer but not from the command line. When I create an NFS4 volume in portainer, it looks like this:

$ docker volume inspect testvol

[
    {
        "CreatedAt": "2023-07-10T10:31:36-05:00",
        "Driver": "local",
        "Labels": null,
        "Mountpoint": "/var/lib/docker/volumes/testvol/_data",
        "Name": "testvol",
        "Options": {
            "device": ":/mnt/main/nfs/volumes/testvol",
            "o": "addr=mytruenas,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14,nfsvers=4",
            "type": "nfs"
        },
        "Scope": "local"
    }
]

But when I try to create an NFS volume from the command line using the same options it does this:

$ docker volume create --driver local --opt type=nfs --opt addr=mytruenas,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14,nfsvers=4 --opt device=:/mnt/main/nfs/volumes/testvol2 testvol2

Error response from daemon: create testvol: invalid option: "addr"

I’ve tried putting things in quotes, etc. What am I doing wrong?

Thanks!

— Lobanz

You might want to start the most minimal set of options:

  • addr=mytruenas
  • nfsvers=4

If this already doesn’t work, try to replace the hostname with the ip. Furthermore, you can check inside the container which additional options are propagated, so that you just add those that need tweaking.

My bad, I missed out on this one. Try:

docker volume create --driver local  \
  --opt type=nfs \
  --opt o=addr=mytruenas,rw,noatime,rsize=8192,wsize=8192,tcp,timeo=14,nfsvers=4 \
  --opt device=:/mnt/main/nfs/volumes/testvol2 \
  testvol2

I added o= in front of addr

DOH! My bad! I had that at one point but lost it somewhere along the way.

It’s working now!

Thanks!

— Lobanz