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



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
launch.json是用于配置调试器在Linux环境下启动和调试应用程序的文件。这个文件通常位于项目的.vscode文件夹中。 在launch.json中,我们可以添加多个配置对象,每个对象对应一个启动配置。每个启动配置指定了特定的调试器以及需要调试的程序、脚本、工作目录等信息。 一个常见的launch.json配置示例如下: ```json { "version": "0.2.0", "configurations": [ { "name": "C++ Debug", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/hello", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": true, } ] } ``` 在上述示例中,我们定义了一个名为"C++ Debug"的调试配置。它的"type"属性指定了调试器类型,这里是"cppdbg",代表C++调试器。"request"属性指定了调试器的请求类型,这里是"launch",表示启动调试。"program"属性指定了要调试的程序路径,这里是`${workspaceFolder}/hello`,表示调试项目中名为"hello"的可执行文件。"args"属性用于指定程序启动时的参数列表。"stopAtEntry"属性设置是否在程序入口处停止调试。"cwd"属性指定了程序的工作目录。"environment"属性可用于指定环境变量。"externalConsole"属性设置是否在外部控制台打开调试。 通过修改launch.json中的配置,我们可以满足不同的调试需求,比如调试不同的文件、脚本,使用不同的调试器等。 总之,launch.json是用于在Linux环境下配置启动和调试应用程序的重要文件,通过对这个文件的配置,我们可以灵活地进行调试工作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值