Share files between LXC containers

grobs

Active Member
Apr 1, 2016
56
0
26
37
France
Hi everyone,

Short question: What is the best way to share files between several LXC containers?

I have a Proxmox 4 cluster and a Proxmox5 (ZFS storage) cluster.
In both of them, I would like to create a shared filesystem (NFS, ZFS or whatever...) and mount it into several LXC containers in order to read and write files on this shared filesystem.

I found some wiki pages and forum posts that are about this but I'm still a bit confused with the best way to do this.

Regards
 
Technically, you want to share a folder, not a filesystem, which is not as easy as it sounds. On a file level, there are several tools available, that work via network e.g. NFS, SAMBA/CIFS. If you have ZFS on your PVE, you can just bind-mount directories into your container, but be aware, you cannot snapshot them anymore with bind-mounts

So, the "best way " (to have all features, yet use a kind of shared filesystem) is to have the data external and mount it in via NFS/CIFS. This setup is more complicated and needs probably more permissions on the LXC side, yet you can still snapshot everything.
 
Problem with NFS/SMB shares inside LXCs is that this is only allow for the more unsecure privileged LXCs (and you need to enable the NFS/CIFS feature first).
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!