[lxc-users] Nested containers - lxcbr0 IP allocation

Serge Hallyn serge.hallyn at ubuntu.com
Thu Apr 2 20:58:26 UTC 2015


Quoting Mark Clarkson (mark.clarkson at smorg.co.uk):
> Hi,
> Instead of doing testing of LXC in a full VM (e.g. virtualbox), I'm
> doing it in a container. This allows me to run alot of heavy
> software on my laptop where a full vm would struggle. This is my
> lxc-vm.
> 
> lxc-vm (default lxcbr0 is 10.0.3.1)
> 
> In the lxc-vm I am creating more lxc containers. My lxc-ct's.
> 
> lxc-vm
>  '- lxc-ct (default lxcbr0 is 10.0.4.1)
> 
> In the lxc-ct I also install lxc since it sets up cgroups for me. In
> these containers I run docker containers. This is lxc-final.
> 
> lxc-vm
>  '- lxc-ct
>      '- lxc-final (default lxcbr0 is 10.0.3.1)
> 
> In lxc-final the default lxcbr0 is 10.0.3.1, breaking routing back
> to the host. I think lxc chose these bridge addresses, and cleverly
> chose a different one for the nested container.
> 
> Instead of lxc-final reverting back to 10.0.3.1, could it choose the
> next number in the third octet? So multiple levels of nesting will

Heh, yes, I think that would be nice.

> always work without editing default/lxc-net, for example:
> 
> lxc-root - 10.0.3.1
> '- lxc-nest1 - 10.0.4.1
>    '- lxc-nest2 - 10.0.5.1
>       '- lxc-nest3 - 10.0.6.1
> 
> Also, I couldn't find where lxc writes /etc/default/lxc-net. Which
> file writes lxc-net?

It's done in preinst actually:

https://github.com/lxc/lxc-pkg-ubuntu/blob/dpm-vivid/debian/lxc.preinst


More information about the lxc-users mailing list