I have attempted to google and have found a few things but none of it really makes sense to me (beginner in the Ubuntu server / Portainer / Docker space)

I have installed Ubunut server 22.04 and used the inbuilt docker as part of the intial install.

From there I installed Portainer

docker volume create portainer_data

sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest

I then added NFS shares from another server via fstab

Then when in Portainer - from what I gathered I should have been able to set bind to /media/nfsshare1

But that does not work.

And then when attempting to add an NFS volume the containers can’t see anything or use them if I point them to the volume.

Any help - or step by step idiot guide for this would be super appreciated

  • james-portainer@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    10 months ago

    If you’ve mounted your share to /media/nfsshare1 on your host OS and you can write to it from within Linux, you should just be able to bind mount /media/nfsshare1 to a directory within your container in the same way you do a non-NFS local path - under the Volumes tab in Advanced container settings when creating a container, or in your stack yaml. As far as Docker will be concerned, it is a local path - since the mounting is done at the OS level through fstab, Docker has no idea what it actually is underneath.

    If on the other hand you want to create a NFS volume in Portainer, you wouldn’t do the mounting via fstab and instead do it all in the Create volume page (or in your stack yaml).