I've been using the following to share a folder from my LCX host into a container:
lxc config device add containerxyz directoryname disk source=/storage/containerxyz path=/mnt/storage/
This works perfectly fine, I can have the container read and write files to the /storage/containerxyz
path in the host, however I see online some people suggesting do to this instead:
lxc.mount.entry = /storage/containerxyz /var/lib/lxc/containerxyz/rootfs/mnt/storage/ none bind 0 0
Whats the practical difference between those two ways to having host directory available to the container and drawbacks of each one?
Some clarifications first: Both LXC and LXD are tools to manage Linux containers. LXC is low level, LXD is a newer, more polished containers manager.
So,
lxc config
is LXD's way to configure a Linux container, whilelxc.mount.entry =
inside container's config file is LXC's lower level way to achieve the same thing.Apparently you use LXD, so stick with it, there's nothing wrong.