How to mount a Network Share inside an Unprivileged (or Privileged) Linux Container (LXC) in Proxmox.
NOTE: This is non-trivial because Unprivileged LXC Containers do not have the privileges available to directly mount network locations.
The work around involves mounting the network share on the Container Host and then binding the mount folder on the host to a folder in the Container.
Log into the Container as root.
mkdir /mnt/extfolder
Use the GUI.
NOTE: If necessary, create a credentials file with the username and password for the network share.
Add the following lines to /root/.credentials/my-credentials.
username=theusername password=thepassword workgroup=theworkgroup
Save your changes.
chmod 600 /root/.credentials/my-credentials
mkdir /mnt/netfolder
Add a line to your fstab file to mount the network share:
Add the following line to the bottom:
//net/path/to/netfolder /mnt/netfolder cifs user,credentials=/root/.credentials/my-credentials,iocharset=utf8,noperm 0 0
mount -a
NOTE: The network share content should be visible at /mnt/netfolder.
Edit /etc/pve/nodes/hostname/lxc/mycontainer.conf.
Add the following line after memory and before net0.
mp0: /mnt/netfolder,mp=/mnt/extfolder
NOTE: The network share should be accessible at /mnt/extfolder