There are a few different recipes out there, but most of them are outdated as of the writing of this post. I just tried this and was able to share directory '/var/foo' from the host to container 'foo'. Add the following (or equivalent) line to your container's config file, in this case
But you do have to make sure both directories exist before starting the container. There's an extra option to the line above that will cause the directory to be created in the container if it doesn't exist, but I haven't tested it.
/var/lib/lxc/foo/config
.
lxc.mount.entry = /var/foo /var/lib/lxc/foo/rootfs/var/foo none bind.ro 0.0
But you do have to make sure both directories exist before starting the container. There's an extra option to the line above that will cause the directory to be created in the container if it doesn't exist, but I haven't tested it.
No comments:
Post a Comment