[Lxc-users] Create container as clone of host

Cody Doucette doucette at bu.edu
Tue Apr 2 03:48:28 UTC 2013


Hi all,

I'm a student and pretty new to LXC. I'm having a little bit of difficulty and
hoping someone could point me in the right direction.

A project that I'm working on has made some changes to the network stack in the
Linux kernel, and we're looking to test those changes utilizing containers. Each
of these containers should be a clone of the host system which is running our
own custom version of the kernel under Ubuntu 12.10.

So far I have a pretty simple LXC configuration file:

lxc.utsname = my_container
lxc.tty = 4
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.mtu = 1500
lxc.network.ipv4 = 0.0.0.0/24
lxc.rootfs = /var/lib/lxc/my_container
lxc.mount = /var/lib/lxc/fstab.lxc

And a similarly simple fstab file:

/ /var/lib/lxc/my_container none bind 0 0

And am (perhaps naively) trying to create a container with the above using:

# lxc-create -f /var/lib/lxc/config.lxc -n my_container

So naturally I was hoping after executing the above that
/var/lib/lxc/my_container would be a bind mount of / (root), but that was not
the case. Eventually, each container of course does not need to be a complete
copy of the host, but I figured I would start with trying to do a basic clone of
everything and then pare it down to what is really needed.

Could anyone nudge me in the right direction? Any tips would be appreciated.

Gratefully,

Cody





More information about the lxc-users mailing list