hopefully i am not bothering anyone with all my questions in the last few days but surprisingly i got another one today.
Does LXD support sharing folders between containers?
Use case is that nginx that acts as a reverse proxy needs access to a folder that is located inside another container. I assume i could do this with samba but maybe i can do this with lxd directly?
When i did some research i could only find a way to do this from the host machine to a container but not between containers.
The recommended way to handle this is by creating a custom storage volume with lxc storage volume create and then attach it to both containers at the relevant path.
Something like:
lxc storage create default blah
lxc config device add c1 blah disk pool=default source=blah path=/blah
lxc config device add c2 blah disk pool=default source=blah path=/blah
Just for “ease of mind”, is this more or less experimental or is sharing a zfs volume among containers like i just did, totally legit and can considered to be stable?
No conflicts when both containers try to write to the same zfs volume at the same time.
Should i rather mount them read only in my other containers. (if thats an option)
#lxc storage create default blah
Error: Invalid value: blah (not one of [btrfs cephfs dir lvm zfs ceph])
#lxc storage create [/home/rm 12:49 Sat 4]
Description:
Create storage pools
Usage:
lxc storage create [<remote>:]<pool> <driver> [key=value...] [flags]
Flags:
--target Cluster member name
Global Flags:
--debug Show all debug messages
--force-local Force using the local unix socket
-h, --help Print help
--project string Override the source project
-q, --quiet Don't show progress information
-v, --verbose Show all information messages
--version Print version number
Hello everybody, I’m having problems attaching the volume to the containers, I’m running a 3 node LXD cluster, it says that the volume is already attached to another container, instead in same machine (node) this method works perfectly.
There is a way to share a folder between containers in a cluster configuration? I wanna avoid NFS and privileged containers.
PS: I’m thinking that a possible solution would be create a shared folder (NFS) on all host, and then mount the same location individually on each LXC container I’m willing to share files with, but I would like to know if it is possible the approach described above.
The only storage driver which allows for a volume to be attached to multiple instances on multiple nodes at once is cephfs. If you don’t have a Ceph cluster with Ceph-FS enabled, then you can only share volumes with whatever instances are on the same node as the storage volume.
Outside of LXD, you certainly could mount the same NFS mount on all servers under /mnt or whatever and then use regular LXD disk devices to bind-mount it into your different instances. This should work just fine.
Not really, ZFS has some optional interaction with samba and with some NFS servers but it’s really just some kind of shared property on the dataset which can then be used to configure separate NFS or SMB servers.