launch a linux container

此篇是工作笔记:

lxc-0.9.0 and lxc1.0.0 的 POWER 架构demo板的linux kernel配置:

kernel config:

General setup  --->
        [*] Control Group support  --->
                [*]   Example debug cgroup subsystem                                                                                  
                [*]   Freezer cgroup subsystem
                [*]   Device controller for cgroups
                [*]   Cpuset support
                [*]     Include legacy /proc/<pid>/cpuset file
                [*]   Simple CPU accounting cgroup subsystem
                [*]   Resource counters
                [*]     Memory Resource Controller for Control Groups
                [*]       Memory Resource Controller Swap Extension
                [*]         Memory Resource Controller Swap Extension enabled by default
                [*]       Memory Resource Controller Kernel Memory accounting (EXPERIMENTAL)
                [*]     HugeTLB Resource Controller for Control Groups
                [*]   Group CPU scheduler  --->
                [*]   Block IO controller
                [*]     Enable Block IO controller debugging
        [*] Namespaces support  --->
                [*]   UTS namespace
                [*]   IPC namespace
                [*]   PID Namespaces
                [*]   Network namespace
[*] Networking support  --->
        Networking options  --->
                <*> 802.1d Ethernet Bridging
                [*]   IGMP/MLD snooping
                <*> 802.1Q VLAN Support
                [*]   GVRP (GARP VLAN Registration Protocol) support
Device Drivers  --->
        [*] Network device support  --->
                <*>     MAC-VLAN support (EXPERIMENTAL)
                <*>       MAC-VLAN based tap driver (EXPERIMENTAL)
                <*>     Virtual ethernet pair device
        Character devices  --->
                [*]   Support multiple instances of devpts
File systems  --->
        <*> Second extended fs support
        [*]   Ext2 extended attributes
        [*]     Ext2 POSIX Access Control Lists
        [*]   Ext3 extended attributes
        [*]     Ext3 POSIX Access Control Lists
       <*> The Extended 4 (ext4) filesystem
        [*]   Ext4 POSIX Access Control Lists
       

 busybox config

[*] Busybox settings

         [*]    Build Options
                      [*]      Build BusyBox as a static binary (no shared libs)           

               Networking Utilities

                   [*] inetd

                   [ ] Support RPC services

 

If enabling  below  udhcp client configure

  Networking Utilities

  [ *]     udhcp client (udhcpc)

  Need corresponding bootargs :

  add ip=dhcp in bootargs

 If disabling below  udhcp client configure

  Networking Utilities

  [ ]     udhcp client (udhcpc)

  Need not additional configration for bootargs.

  Need not additional configration for bootargs.

rootfs configuration

Add lxc package.

Add hv-test package if doing hv-test.

------------------------------------------------------------------------------------------

basic steps:

1. bootup linux.

2. mount the 'cgroups' pseudo-filesystem.
#mkdir /cgroup
#mount -t tmpfs cgroup /cgroup
#mkdir /cgroup/{freezer,devices,memory,cpuacct,cpuset,cpu}
#mount -t cgroup -o freezer cgroup /cgroup/freezer
#mount -t cgroup -o devices cgroup /cgroup/devices
#mount -t cgroup -o memory cgroup /cgroup/memory
#mount -t cgroup -o cpuacct cgroup /cgroup/cpuacct
#mount -t cgroup -o cpuset cgroup /cgroup/cpuset

#mount -t cgroup -o cpu cgroup /cgroup/cpu

3. check the dir " /var/lib/lxc" existing or not

    # ls /var/lib/lxc

   If it does not exist please  create the following working folder.
   # mkdir /var/lib/lxc

4. # lxc-create -n vm -t busybox -f /usr/share/doc/lxc/examples/lxc-no-netns.conf

5.watch working directory:

#ls /var/lib/lxc/

6.# lxc-start -n ctx1

7.# lxc-stop -n ctx1

8.# lxc-destroy -n ctx1



阅读更多
文章标签: linux container
个人分类: virtualization
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭