Hello,
What is the “standard incus way” to mount a directory from a container into another container?
Context: 2 containers, storage pool is ZFS, container1 runs a daemon, container2 runs a monitoring software which needs to access logs from container1 to have something to monitor.
Container2 needs read-only access to /var/log from Container1, so the directory would need to be mounted on Container2 as /mnt/container1/var/log for example.
I would prefer to avoid NFS, Samba etc, and I would also prefer to avoid having both containers mount a common host directory, meaning Container1 is oblivious to the fact that /var/log is being exported, and the /var/log data is not a specific zfs mount or anything like that.
Most solutions either recommend to mount a shared directory from the host, or rely on standard file sharing protocols.
Is there an “simple incus way” to do such thing?
The best way to do this is to create a custom storage volume, attach it as writable to the first container, mounting it on /var/log or appropriate, then mount it somewhere else within the second container as read-only.
So it’s basically using a shared directory but rather than creating it on the host yourself, using a native Incus storage volume for that instead.
Thank you, I wanted to avoid that as I would prefer “container1” to be “normal” and easily migratable to another server if needed, but I understand this is not possible.
Is there any documentation on what flags to set to have the volume be read only on the second container it is attached to? Or do I need to do that inside the container?