[lxc-users] How to build LXC templates from ISO or installed OS please ?

Michael H. Warfield mhw at WittsEnd.com
Wed Apr 22 20:20:09 UTC 2015


Ok...  I think I just made the connection between you and the "Narahari"
who posted a very similar question from a different E-Mail address to
the ALE (Atlanta Linux Enthusiasts) list to which I responded earlier
today.

On Wed, 2015-04-22 at 15:28 -0400, Narahari Lakshminarayana wrote:
> If anyone has tried creating LXC templates from iso's or from
> installed machine please share.  I would love to create
> lxc=templates ?

I don't understand by what you mean with "lxc=templates".  If you mean
to create a template script for SLES, you could base it off the
lxc-opensuse script in the project.  It's just a shell script but you
would need access to the SLES repositories.

I did ask what version of LXC you had installed on SLES 11SP3 system and
what kernel version it was running.  Seems like 11SP3 is rather old and
the OpenSUSE equivalent, 11.3, is out of support.  I can still get 11.4
iso's but I don't see 11.3 iso's.  Checking the download site at
download.opensuse.org/distribution also only shows the 11.4 release (and
it's the oldest still present).

I'll repeat my other remarks from the ALE list in-line below...

> -Narahari
> 
> On Tue, Apr 21, 2015 at 7:20 PM, Narahari Lakshminarayana
> <itsme.narahari at gmail.com> wrote:
>         Good Evening friends:
>         
>         
>                 Here is the scenario.  My office has SLES 11SP3.  I
>                 installed LXC it and then I enabled LXC on it.  The
>                 LXC stuff went thru fine.
>                 
>                 
>                 When I tried to get a container up and running with a
>                 predefined template the only Suse related is Open-Suse
>                 13SP1.
>                 
Where did you get this "predefined" template?

We have some template scripts that generate containers.  I've done some
work on the lxc-opensuse template script and I have contacts at Suse.
It has a "-r release" option but it's strictly going to pull from the
OpenSuse repos.

We also have a "download" template which pulls predefined container
images from "images.linuxcontainers.org" and that has OpenSuse images
but, currently, only for 12.3.  So I'm really confused where this 13SP1
came from... 

>                 I tried using that and it did not work since the libs
>                 are incompatible.

Ah, this I don't understand.  The libs in the container are separate and
independent from the libs in the host.  I've even got a OpenSuse
container running on my Fedora 21 host.  In fact, that's how I
bootstrapped the whole image process to get OpenSuse images into the
download template repository for Stephan's download template.
>                 
>                 In this context I would like to build a LXC template
>                 from the SLES 11SP3 ISO directly or from the installed
>                 OS(using the SLES 11SP3).

If you have LXC installed on 11SP3 as you say...  What do you get when
you run this command:

lxc-create -n suse1 -t opensuse

If everything is working on the host, it should install a container
named "suse1" that is a version of opensuse.
>                 
>                 All examples I see are for cents or ubuntu or debian.

We have templates for alpine, alt, arch, busybox, cirros, opengentoo,
mandrivia, oracle, debian, ubuntu, centos, fedora and more.  Not all
templates work on all hosts (I think I have the Fedora and CentOS
templates working pretty well on most hosts) but the container images
downloaded using the download template should work on all supported host
platforms.
>                 
>                 Any inputs on SLES LXC template building is
>                 appreciated ?

>                 What should I be doing to create the template by hand
>                 or with a tool ?
>         

You should be using lxc-create but we don't have templates or images for
SLES (or RHEL for that matter), since that's a licensed commercial
distribution.

In theory, you could take the iso and install it into a heavy weight VM,
like LKVM or VirtualBox, and then copy (rsync) the logical file system
over to a directory you could then start as a container.  You would have
to hand roll the LXC config file but it should be that difficult.  Then
pop a bag of popcorn and brew some coffee while you work through any
startup errors that ensue when you start it up.

Assuming (and this can be a very BAD assumption) that SLES 11SP3 has a
kernel that supports containers, it should work.  But it can take some
work...

>         -N

Regards,
Mike
-- 
Michael H. Warfield (AI4NB) | (770) 978-7061 |  mhw at WittsEnd.com
   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
   NIC whois: MHW9          | An optimist believes we live in the best of all
 PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 465 bytes
Desc: This is a digitally signed message part
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20150422/1448d439/attachment.sig>


More information about the lxc-users mailing list