I don’t have a lot of experience with NFS.
I have a few VMs I use to host a variety of docker containers. I’d like to start moving or rebuilding them so that their persistent volumes live on TrueNAS instead.
I have the main dataset on my pool, and underneath it I created another dataset I called docker-volumes
. I also setup NFS in TrueNAS and created an NFS share with this dataset. I specified specific hosts on my network to have access (IP address) and per some random YouTube video, I configured the ‘maproot User’ as root.
Now I am trying to create a docker compose file to mount this dataset, but I’m running into trouble. I’ve tried a few compose permutations, this is a simplified version of what I have right now.
services:
webnut:
image: edgd1er/webnut:latest
container_name: webnut
restart: always
ports:
- "6543:6543"
volumes:
- webnut_config:/webnut/config
volumes:
webnut_config:
driver: local
driver_opts:
type: "nfs"
o: "addr=TRUENAS-IP,nfsvers=4"
device: ":/docker-volumes"
When I try to start the container, I get the error:
Error response from daemon: error while mounting volume '/var/lib/docker/volumes/webnut-nfs_webnut_config/_data': failed to mount local volume: mount :/docker-volumes:/var/lib/docker/volumes/webnut-nfs_webnut_config/_data, data: addr=TRUENAS-IP,nfsvers=4: no such file or directory
From googling around it sounds like the issue might be the target folder isn’t created. If that’s the case, I’m sort of confused on how to set that up. Do I need to create a folder (a sub dataset?) for each app I want to run? Do I need to expose those all as NFS shares, or just the root? What is the right way to setup the compose file?
Ideally I get to the point where I can have a few different hosts I use to run docker containers, and I can easily move those containers around - they all just point to the appropriate volume location for that app and it just works.