D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] More on Containers

 

On Sun, 21 Feb 2010, Gordon Henderson wrote:

The third is LXC... And it seems to be used by IBM, so I thought I'd give it a go - wished I'd tried first as it is actually fully supported in stock kernels (although still 'experimental'), as of 2.6.29.

http://www.ibm.com/developerworks/linux/library/l-lxc-containers/

All that's needed is the userland programs to utilise it - not standard under Debian Lenny, but it's in testing... (they are standard under Ubuntu (and the Ubuntu kernel supports it out of the box)

So-far so good.... And when I get more time I'll have more to say, but it's actually looking very good at this point.

Just FYI: It's still looking good and I now have a working system after some initial frustrations that appear to be down to the kernel version, or some kernel flag that's different between 2.6.31 (which works) and 2.6.32 (which doesn't) work.

For userland, the current testing package installs and runs fine, but compiling from source is easy too.

From inside a container:

dsx$ ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 init [2]
   10 ?        Ss     0:00 /sbin/syslogd
   15 ?        Ss     0:00 /sbin/klogd -x
   23 ?        Ss     0:00 /usr/sbin/sshd
   26 ?        Ss     0:00 /usr/local/apache2/bin/httpd -k start
   34 ?        S      0:00 /usr/local/apache2/bin/httpd -k start
   62 ?        Ss     0:00 sendmail: Queue control
   63 ?        S      0:00 sendmail: running queue: /var/spool/clientmqueue
   65 ?        Ss     0:00 sendmail: accepting connections
   76 ?        Ss     0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g
   93 ?        Ss     0:00 /usr/sbin/cron
  106 pts/1    Ss+    0:00 /sbin/getty 38400 tty1
  107 ?        Ss     0:00 sshd: dsx@pts/3
  109 pts/3    Ss     0:00 login -h 192.168.254.11 -p -f
  110 pts/3    R      0:00 -bash
  115 pts/3    R+     0:00 ps ax

dsx$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:fc:00:de:fa:ce
          inet addr:192.168.254.40  Bcast:0.0.0.0  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:185 errors:0 dropped:0 overruns:0 frame:0
          TX packets:89 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17969 (17.5 KiB)  TX bytes:15553 (15.1 KiB)


I need to tweak my startup scripts to make it more efficient (ie. don't even think about doing disk checks, etc. and no need to run ntpd either), but this is running sshd and I can ssh into it from another host just as if it were a real host on the network.

It shares all the cpu & memory resources of the host -

top on the host:

top - 13:48:43 up  1:00,  4 users,  load average: 0.00, 0.00, 0.00
Tasks:  61 total,   1 running,  60 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    252624k total,   143196k used,   109428k free,     6168k buffers
Swap:        0k total,        0k used,        0k free,   115520k cached

top in the container:

top - 13:48:52 up  1:00,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  16 total,   1 running,  15 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.6%us,  0.2%sy,  0.0%ni, 98.7%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    252624k total,   143376k used,   109248k free,     6168k buffers
Swap:        0k total,        0k used,        0k free,   115520k cached

They share uptime.

For networking, the host runs the Ethernet bridging, so looks like an Ethernet switch to the network, then each container (and the host) has it's own eth0 device to use (containers need to have an 'invented' MAC address though) If does mean that individual containers can have their own iptables though, and the host bridges rather than routes which is probably more efficient.

I can init 0 a container - it doesn't init 6 to reboot though...

So there you go: LXC: Done.

Gordon

--
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html