How to share folder from TrueNAS VM to docker container

thimplicity

Member
Feb 4, 2022
73
9
13
44
Hi everyone,
I am new to Proxmox and have a TrueNAS Core VM running as well as a docker container (based on Debian Turnkey). I am trying to mount a folder from TrueNAS into the docker container. I have tried NFS and CIFS. Always a permission error message. I read that this is not doable with an unprivileged container.

What is the best way to get it done still? Do I have to create a privileged container or is there an option with the current setup?
 
Only privileged LXCs can mount NFS/SMB shares. But privileged LXCs are unsecure and therefore should be avoided, especially if you want to port-forward to them or run software from sources you can't really trust (like you often can't do when running 3rd-party docker containers).

As a workaround for the more secure unprivileged LXC you could mount the NFS/SMB shares directly on your host and then use bind-mounts to bring the mountpoints of the shares into your unprivileged LXC. But this is quite annoying because you need to edit the user remapping and in case of PVE reinstallation you can't just restore the LXC from backups because the LXC won't work out of the box without editing the host again.

Best would be to run docker inside a VM where mounting SMB/NFS is no problem. Running Docker inside a VM is the recommended way to run docker according to the PVE staff.
 
  • Like
Reactions: thimplicity
Only privileged LXCs can mount NFS/SMB shares. But privileged LXCs are unsecure and therefore should be avoided, especially if you want to port-forward to them or run software from sources you can't really trust (like you often can't do when running 3rd-party docker containers).

As a workaround for the more secure unprivileged LXC you could mount the NFS/SMB shares directly on your host and then use bind-mounts to bring the mountpoints of the shares into your unprivileged LXC. But this is quite annoying because you need to edit the user remapping and in case of PVE reinstallation you can't just restore the LXC from backups because the LXC won't work out of the box without editing the host again.

Best would be to run docker inside a VM where mounting SMB/NFS is no problem. Running Docker inside a VM is the recommended way to run docker according to the PVE staff.

Thanks! I went for the LXC because I understood it needs far fewer resources than a VM. Which setup would you recommend as a VM - just an Ubuntu VM with Docker installed?
 
According to the docker documentation ubuntu is recommended because it got the newest kernel so you can use the most docker features.
Or you just choose the Linux you are most familiar with for less user errors.
 
According to the docker documentation ubuntu is recommended because it got the newest kernel so you can use the most docker features.
Or you just choose the Linux you are most familiar with for less user errors.
I am not familiar with any of them yet - you ubuntu it is :)
 
According to the docker documentation ubuntu is recommended because it got the newest kernel so you can use the most docker features.
Or you just choose the Linux you are most familiar with for less user errors.
Is there a special minimal ubuntu image I should use? I am trying to avoid using a lot of resources for it
 

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!