Give LXC contain access to files on the host

I have media files located on my router at /mnt/raid/media that I would like to share with the minidlna instance that I’ve installed on a LXC container (/srv/lxc/ubuntu_eoan). How do I do this?

in you lxc config /srv/lxc/<your_container>/config you can add this:
lxc.mount.entry = /mnt/raid/media mnt/Data/media none bind 0 0
and it will be mounted in lxc OS under /mnt/Data/media resp in fact … /srv/lxc/<your_container>/rootfs/mnt/Data/media on TOS >> note: missing leading “/” in target path in lxc.config is not a mistake due fact that mnt is within local fs structure, so lxc home-root is added during init of lxc automatically)
There is also another way (depending if you run lxc as privileged or non-privileged) each has own cons/pros

1 Like

That worked well. Thank you.