[Lxc-users] Bind mounting a file to the container

Csordás Csaba Ifj. cscsordas at gmail.com
Wed Feb 20 21:21:23 UTC 2013


Hi,

there is a suggestion at http://lxc.sourceforge.net/man/lxc.html:


make accessible from the container the resolv.conf file belonging to the host.

/etc/resolv.conf /home/root/debian/rootfs/etc/resolv.conf none bind 0 0

When using this with live-deboconfig, i.e.:

lxc-debconfig lxc-debconfig/mount0/entry string /etc/resolv.conf
/var/lib/lxc/template/rootfs/etc/resolv.conf none bind 0 0
lxc-debconfig lxc-debconfig/mount0/comment string Bind mounting host's
resolv.conf to the container.

it gives error messages, because the script wants to create the source
and target directories.

mkdir: cannot create directory `/etc/resolv.conf': File exists
mkdir: cannot create directory
`/var/lib/lxc/template/rootfs/etc/resolv.conf': File exists
'debian' template installed
'template' created

In this specfic case the second message is true but not correct. I
think the target must be created only if it is a directory.


Csordás Csaba Ifj.




More information about the lxc-users mailing list