Can I map a single file in an NFS share

Hi folks. I’m fairly new at the whole Rancher mallarkey, so forgive me if this is simple/old/obvious.
I am setting up a test environment on a local machine to learn Rancher, so will have multiple hosts running RancherOS. In order to allow distributing my persistent data, I thought I’d use NFS on my actual machine in lieu of a sort of NAS/SAN.

I have added some storage to my Rancher setup, in my case called wikifiles.
I created a test container and mapping a volume of wikifiles:/tmp/testingnfs worked just fine.

Now my question is how to handle single-file “volumes”. For example, I have a wikijs container that wants a persistent config file mapped, and an SSH key for talking to git. In the basic version, I had it set like this:

volumes:
  - /rancher/wiki/config.yml:/var/wiki/config.yml
  - /rancher/wiki/id_rsa:/etc/wiki/id_rsa

And now I’d like to move that into the NFS. Can I do that with a single-file rancher-nfs volume without altering the container? Or so I need to mount an entire directory, and then alter the container with a symlink or whatever to put those two files “in place”?

Many thanks,

Mark

1 Like

Do the same as you did with wikifiles
Since your files are supposed to be in one dir, mount a NFS dir and store your files. You can also use :ro :rw flags for read-only / read-write

Hi Mark, Same thing here. iam trying to map a single config ro file, but i can not get to a proper solution. For now i will use symlink and alter the image :frowning:

But i think there must to be a way, tried with driver_ops, like exporting the file path, but doesn’t work, it still belive its a directory :thinking:
https://rancher.com/docs/rancher/v1.6/en/rancher-services/storage-service/rancher-nfs/#driver-options

In plain docker its very easy just -v /bla/file.yml:/container/path/file.yml

Any one with a better solution?

thanks,