[Lxc-users] Karmic/Lucid template howto

Brian K. White brian at aljex.com
Mon Feb 1 17:30:26 UTC 2010


On Mon, 2010-02-01 at 09:28 -0500, Michael H. Warfield wrote:
> On Mon, 2010-02-01 at 11:35 +0100, Papp Tamás wrote: 
> > hi All,
> 
> > Is there available any public howto about making templates for this distros?
> 
> Making templates?  Or creating containers from templates?  The former is
> highly non-trivial and should be done infrequently.  The later is what
> most of us really need and don't much more frequently.  The lxc-fedora
> and lxc-debian scripts really don't cut it for me.  If they work
> 
[...]
> I hate sending people over there [OpenVZ] to just leach templates

I have been working on using the distributions normal package
management/install tools as much as possible, to develop a recipe that
results in a minimal install. This way the resulting filesystem is most
like a normal system of that distro, and the recipe works on future
versions instead of being stuck with the last time someone hand-crafted
a template.

I'm only doing this for openSUSE since that's the distro my production
servers all use, and the recipe has many manual steps. But I've only got
about 2 days of time into it so far and the results work.
The resulting system launches sshd and once inside that system the
normal package manager works to install whatever else you want (within
the limits of any container, ie: things that need hardware access or
hardware emulation, such as the recent X11 thread.)

I now have a backup mirror copy of every one of my production servers up
& running as an lxc container, thus freeing up the full hardware servers
each of those clones used to require, allowing all those hardware
servers to become production servers, doubling my capacity overnight and
for free.

http://en.opensuse.org/LXC

Takes me about 1/2 an hour to set up each new container, assuming the
host is already set up. The host only takes a few minutes assuming it's
basically installed already and you're just adding lxc hosting support.
So many steps still that have to be done manually and correctly, like
devising the MAC to use for each virtual nic... 
I basically just cut & paste chunks of those commands from that page and
then edit some of the files that are created with those cat commands.

I haven't yet incorporated the latest ideas for stopping the containers
gracefully from a host rc script.
I do have a start-script there that at least starts up the containers
during boot.

As pain in the neck manual as this is, I would rather do this, and
continue working on this approach and improve this process (and improve
the tools this process relies on and the parts of the OS that currently
need to be butchered in order to work in a container) than to rely on
fixed hand-crafted container templates that just go obsolete in a couple
months. A recipe that uses the systems normal software manager to
install some pattern or group of packages, including maybe an lxc-fixup
kind of package that maybe adds things into the systems startup/shutdown
procedures in a well-integrated way rather than hacking existing system
scripts, is a lot more self maintaining and worthwhile to invest effort
working on.

-- 
bkw





More information about the lxc-users mailing list