[Lxc-users] lxc template for RHEL?

Dan Kegel dank at kegel.com
Sat Aug 25 20:06:26 UTC 2012


On Sat, Aug 25, 2012 at 11:18 AM, Dan Kegel <dank at kegel.com> wrote:
>> https://github.com/fajarnugraha/lxc/blob/centos-template/templates/lxc-centos.in
>
> There's no networking (beyond being able to ping localhost).

https://help.ubuntu.com/12.04/serverguide/lxc.html says
"The simplest container creation command would look like:
sudo lxc-create -t ubuntu -n CN
This tells lxc-create to use the ubuntu template (-t ubuntu) and to
call the container CN (-n CN). Since no configuration file was
specified (which would have been done with `-f file'), it will use the
default configuration file under /etc/lxc/lxc.conf. This gives the
container a single veth network interface attached to the lxcbr0
bridge."

So I tried that on a clean ubuntu 12.04 machine, and
    lxc-create -t ubuntu -n democn
    lxc-start -n democn
did indeed result in a session with a working network.
(Whew.)

Trying the same thing with your centos template:
   cd /usr/lib/lxc/templates/
   wget https://raw.github.com/fajarnugraha/lxc/centos-template/templates/lxc-centos.in
   mv lxc-centos.in lxc-centos
   lxc-create -t centos -n democ6
   lxc-start -n democ6
resulted in a session without working network.
According to ifconfig inside the Centos session, eth0
didn't have an ip address.   I dimly recall that the network
doesn't start by default on Centos desktops, so I did
  /etc/init.d/network start
inside the centos session.  That at least got eth0 an ip address,
but dns still wasn't working.  And it looks like part of the machinery
is missing:
# ls -l /etc/resolv.conf
lrwxrwxrwx 1 root root 29 Mar 12 12:45 /etc/resolv.conf ->
../run/resolvconf/resolv.conf
Adding a real file there made dns work, and I was able to do simple networking.

How far do you think your script is from being ready to go into lxc?
Does it need to start the network automatically, and how should
resolv.conf be handled?

Thanks,
Dan




More information about the lxc-users mailing list