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

Serge Hallyn serge.hallyn at ubuntu.com
Wed Feb 20 21:27:37 UTC 2013


Quoting Csordás Csaba Ifj. (cscsordas at gmail.com):
> 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.

Sorry, the code in question is not in upstream lxc.  It shouldn't be
hard to figure out by looking at the script whether your expectations/
use are wrong, or whether there is a bug you can fix.

-serge




More information about the lxc-users mailing list