[SOLVED] See UPDATE #2 at the bottom
I'm having a bear of a time exposing a CIFS Network Share to an LXC Container.
I tried mounting it directly from within the LXC Container and AppArmor stopped this from happening.
I tried mounting it during the LXC startup using lxc.mount in the config pointing to an fstab that knows how to connect to the CIFS share.
I tried adding a "storage" element from the Proxmox web GUI but there is no option to create a "generic" storage. Everything is "OS Images" or "VZDumps" etc. So Proxmox creates a folder structure in there that I don't want.
I tried mounting the CIFS share on the host and then binding the directory to a directory on the Container.
The most recent thing I'm trying is to mount the CIFS share on the host and then to modify the LXC config to add a mount entry point. I'm attempting to follow this guide but so far, no joy. I just am noticing that my config file (/var/lib/lxc/10x/config) is getting overwritten and reset to defaults whenver I restart the container. https://gist.github.com/julianlam/07abef272136ea14a627
What is the right way to get RW access to a network location in an LXC Container?
UPDATE #1
I got the basic functionality to work by following the above guide by I had to add "lxc-mount" to the end of my config because it didn't previously exist. However, my config file is still getting reset when I restart my container.
UPDATE #2
I got it working. The correct config file to edit is "/etc/pve/lxc/10x.conf" NOT "/var/lib/lxc/10x/config". Also there is higher level syntax that is preferred over the base lxc syntax described in the github link above. This info can be found at (https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points). I added "mp0: /path/to/host/share,mp=/path/to/container/share" to the bottom of "/etc/pve/lxc/10x.conf" and it worked! Thanks to dietmar for the point in the right direction.
UPDATE #3
It looks like you need to have a "Privileged" container to be able to write to your network share. If the access you need is read-only then you can keep the container Unprivileged. You cannot change the Privilege of a container directly from the GUI. You can do this when restoring backups however. It should be fairly straight forward to convert an Unprivileged container into a Privileged container. However the reverse is not as simple. Privileged containers contain files that Unprivileged containers are not allowed to have. They will need to be deleted before restoring to an Unprivileged state. Check out this thread for more info: https://forum.proxmox.com/threads/convert-privileged-to-unprivileged-container.31066/
I've written a step by step guide on how to get Network Share access for a Proxmox Container. You can check it out here
https://steamforge.net/wiki/index.p...work_Share_in_a_Linux_Container_under_Proxmox
I'm having a bear of a time exposing a CIFS Network Share to an LXC Container.
I tried mounting it directly from within the LXC Container and AppArmor stopped this from happening.
I tried mounting it during the LXC startup using lxc.mount in the config pointing to an fstab that knows how to connect to the CIFS share.
I tried adding a "storage" element from the Proxmox web GUI but there is no option to create a "generic" storage. Everything is "OS Images" or "VZDumps" etc. So Proxmox creates a folder structure in there that I don't want.
I tried mounting the CIFS share on the host and then binding the directory to a directory on the Container.
The most recent thing I'm trying is to mount the CIFS share on the host and then to modify the LXC config to add a mount entry point. I'm attempting to follow this guide but so far, no joy. I just am noticing that my config file (/var/lib/lxc/10x/config) is getting overwritten and reset to defaults whenver I restart the container. https://gist.github.com/julianlam/07abef272136ea14a627
What is the right way to get RW access to a network location in an LXC Container?
UPDATE #1
I got the basic functionality to work by following the above guide by I had to add "lxc-mount" to the end of my config because it didn't previously exist. However, my config file is still getting reset when I restart my container.
UPDATE #2
I got it working. The correct config file to edit is "/etc/pve/lxc/10x.conf" NOT "/var/lib/lxc/10x/config". Also there is higher level syntax that is preferred over the base lxc syntax described in the github link above. This info can be found at (https://pve.proxmox.com/wiki/Linux_Container#_bind_mount_points). I added "mp0: /path/to/host/share,mp=/path/to/container/share" to the bottom of "/etc/pve/lxc/10x.conf" and it worked! Thanks to dietmar for the point in the right direction.
UPDATE #3
It looks like you need to have a "Privileged" container to be able to write to your network share. If the access you need is read-only then you can keep the container Unprivileged. You cannot change the Privilege of a container directly from the GUI. You can do this when restoring backups however. It should be fairly straight forward to convert an Unprivileged container into a Privileged container. However the reverse is not as simple. Privileged containers contain files that Unprivileged containers are not allowed to have. They will need to be deleted before restoring to an Unprivileged state. Check out this thread for more info: https://forum.proxmox.com/threads/convert-privileged-to-unprivileged-container.31066/
I've written a step by step guide on how to get Network Share access for a Proxmox Container. You can check it out here
https://steamforge.net/wiki/index.p...work_Share_in_a_Linux_Container_under_Proxmox
Last edited: