From 188533e129fc0243ecae9ec65a7a8901e5d3ce77 Mon Sep 17 00:00:00 2001 From: chopupu <1123478123@qq.com> Date: Thu, 8 May 2025 14:55:31 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E7=B3=BB=E7=BB=9F=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update --- .../container_form/system_container/_toc.yaml | 36 +++++ .../system_container/appendix_1.md} | 0 .../configurable_cgroup_path.md | 12 +- .../dynamically_loading_the_kernel_module.md | 16 +-- ..._container_resources_syscontainer_tools.md | 10 +- .../environment_variable_persisting.md | 9 +- .../installation_guideline.md | 20 ++- .../maximum_number_of_handles.md | 9 +- .../system_container/overview.md | 0 .../reboot_or_shutdown_in_a_container.md | 23 ++-- .../security_and_isolation.md | 127 ++++++++---------- .../shared_memory_channels.md | 18 +-- ...specifying_rootfs_to_create_a_container.md | 15 +-- .../system_container/usage_guide.md | 2 +- .../using_systemd_to_start_a_container.md | 0 .../writable_namespace_kernel_parameters.md | 9 +- 16 files changed, 161 insertions(+), 145 deletions(-) create mode 100644 docs/zh/docs/cloud/container_form/system_container/_toc.yaml rename docs/zh/docs/{Container/appendix_2.md => cloud/container_form/system_container/appendix_1.md} (100%) rename "docs/zh/docs/Container/cgroup\350\267\257\345\276\204\345\217\257\351\205\215\347\275\256.md" => docs/zh/docs/cloud/container_form/system_container/configurable_cgroup_path.md (94%) rename "docs/zh/docs/Container/\345\212\250\346\200\201\345\212\240\350\275\275\345\206\205\346\240\270\346\250\241\345\235\227.md" => docs/zh/docs/cloud/container_form/system_container/dynamically_loading_the_kernel_module.md (82%) rename "docs/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\345\212\250\346\200\201\347\256\241\347\220\206.md" => docs/zh/docs/cloud/container_form/system_container/dynamically_managing_container_resources_syscontainer_tools.md (99%) rename "docs/zh/docs/Container/\347\216\257\345\242\203\345\217\230\351\207\217\346\214\201\344\271\205\345\214\226.md" => docs/zh/docs/cloud/container_form/system_container/environment_variable_persisting.md (90%) rename "docs/zh/docs/Container/\345\256\211\350\243\205\346\214\207\345\257\274.md" => docs/zh/docs/cloud/container_form/system_container/installation_guideline.md (56%) rename "docs/zh/docs/Container/\346\234\200\345\244\247\345\217\245\346\237\204\346\225\260\351\231\220\345\210\266.md" => docs/zh/docs/cloud/container_form/system_container/maximum_number_of_handles.md (92%) rename "docs/zh/docs/Container/\347\263\273\347\273\237\345\256\271\345\231\250.md" => docs/zh/docs/cloud/container_form/system_container/overview.md (100%) rename "docs/zh/docs/Container/\345\256\271\345\231\250\345\206\205reboot-shutdown.md" => docs/zh/docs/cloud/container_form/system_container/reboot_or_shutdown_in_a_container.md (87%) rename "docs/zh/docs/Container/\345\256\211\345\205\250\346\200\247\345\222\214\351\232\224\347\246\273\346\200\247.md" => docs/zh/docs/cloud/container_form/system_container/security_and_isolation.md (72%) rename "docs/zh/docs/Container/\345\205\261\344\272\253\345\206\205\345\255\230\351\200\232\351\201\223.md" => docs/zh/docs/cloud/container_form/system_container/shared_memory_channels.md (80%) rename "docs/zh/docs/Container/\346\214\207\345\256\232rootfs\345\210\233\345\273\272\345\256\271\345\231\250.md" => docs/zh/docs/cloud/container_form/system_container/specifying_rootfs_to_create_a_container.md (79%) rename "docs/zh/docs/Container/\344\275\277\347\224\250\346\214\207\345\215\227-1.md" => docs/zh/docs/cloud/container_form/system_container/usage_guide.md (93%) rename "docs/zh/docs/Container/\351\200\232\350\277\207systemd\345\220\257\345\212\250\345\256\271\345\231\250.md" => docs/zh/docs/cloud/container_form/system_container/using_systemd_to_start_a_container.md (100%) rename "docs/zh/docs/Container/namespace\345\214\226\345\206\205\346\240\270\345\217\202\346\225\260\345\217\257\345\206\231.md" => docs/zh/docs/cloud/container_form/system_container/writable_namespace_kernel_parameters.md (98%) diff --git a/docs/zh/docs/cloud/container_form/system_container/_toc.yaml b/docs/zh/docs/cloud/container_form/system_container/_toc.yaml new file mode 100644 index 000000000..3cde0247c --- /dev/null +++ b/docs/zh/docs/cloud/container_form/system_container/_toc.yaml @@ -0,0 +1,36 @@ +label: 系统容器 +isManual: true +description: 解决在重计算、高性能、大并发的场景下,重型应用和业务云化的问题 +sections: + +- label: 概述 + href: ./overview.md +- label: 安装指导 + href: ./installation_guideline.md +- label: 使用指南 + href: ./usage_guide.md + sections: + - label: 指定rootfs创建容器 + href: ./specifying_rootfs_to_create_a_container.md + - label: 通过systemd启动容器 + href: ./using_systemd_to_start_a_container.md + - label: 容器内reboot/shutdown + href: ./reboot_or_shutdown_in_a_container.md + - label: cgroup路径可配置 + href: ./configurable_cgroup_path.md + - label: namespace化内核参数可写 + href: ./writable_namespace_kernel_parameters.md + - label: 共享内存通道 + href: ./shared_memory_channels.md + - label: 动态加载内核模块 + href: ./dynamically_loading_the_kernel_module.md + - label: 环境变量持久化 + href: ./environment_variable_persisting.md + - label: 最大句柄数限制 + href: ./maximum_number_of_handles.md + - label: 安全性和隔离性 + href: ./security_and_isolation.md + - label: 容器资源动态管理 + href: ./dynamically_managing_container_resources_syscontainer_tools.md +- label: 附录 + href: ./appendix_1.md diff --git a/docs/zh/docs/Container/appendix_2.md b/docs/zh/docs/cloud/container_form/system_container/appendix_1.md similarity index 100% rename from docs/zh/docs/Container/appendix_2.md rename to docs/zh/docs/cloud/container_form/system_container/appendix_1.md diff --git "a/docs/zh/docs/Container/cgroup\350\267\257\345\276\204\345\217\257\351\205\215\347\275\256.md" b/docs/zh/docs/cloud/container_form/system_container/configurable_cgroup_path.md similarity index 94% rename from "docs/zh/docs/Container/cgroup\350\267\257\345\276\204\345\217\257\351\205\215\347\275\256.md" rename to docs/zh/docs/cloud/container_form/system_container/configurable_cgroup_path.md index d737c0cd9..3465df9c4 100644 --- "a/docs/zh/docs/Container/cgroup\350\267\257\345\276\204\345\217\257\351\205\215\347\275\256.md" +++ b/docs/zh/docs/cloud/container_form/system_container/configurable_cgroup_path.md @@ -1,4 +1,5 @@ # cgroup路径可配置 + ## 功能描述 系统容器提供在宿主机上进行容器资源隔离和预留的能力。通过\--cgroup-parent参数,可以将容器使用的cgroup目录指定到某个特定目录下,从而达到灵活分配宿主机资源的目的。例如可以设置容器a、b、c的cgroup父路径为/lxc/cgroup1,容器d、e、f的cgroup父路径为/lxc/cgroup2,这样通过cgroup路径将容器分为两个group,实现容器cgroup组层面的资源隔离。 @@ -47,21 +48,21 @@ ## 约束限制 -- 如果daemon端和客户端都设置了cgroup parent参数,最终以客户端指定的\--cgroup-parent生效。 -- 如果已启动容器A,然后启动容器B,容器B的cgroup父路径指定为容器A的cgroup路径,在删除容器的时候需要先删除容器B再删除容器A,否则会导致cgroup资源残留。 +- 如果daemon端和客户端都设置了cgroup parent参数,最终以客户端指定的\--cgroup-parent生效。 +- 如果已启动容器A,然后启动容器B,容器B的cgroup父路径指定为容器A的cgroup路径,在删除容器的时候需要先删除容器B再删除容器A,否则会导致cgroup资源残留。 ## 使用示例 启动系统容器,指定--cgroup-parent参数: -``` +```sh [root@localhost ~]# isula run -tid --cgroup-parent /lxc/cgroup123 --system-container --external-rootfs /root/myrootfs none init 115878a4dfc7c5b8c62ef8a4b44f216485422be9a28f447a4b9ecac4609f332e ``` 查看容器init进程的cgroup信息: -``` +```sh [root@localhost ~]# isula inspect -f "{{json .State.Pid}}" 11 22167 [root@localhost ~]# cat /proc/22167/cgroup @@ -85,11 +86,10 @@ 同时,对于所有容器cgroup父路径的设置可以配置一下容器daemon文件,例如: -``` +```conf { "cgroup-parent": "/lxc/cgroup123", } ``` 然后重启容器引擎,配置生效。 - diff --git "a/docs/zh/docs/Container/\345\212\250\346\200\201\345\212\240\350\275\275\345\206\205\346\240\270\346\250\241\345\235\227.md" b/docs/zh/docs/cloud/container_form/system_container/dynamically_loading_the_kernel_module.md similarity index 82% rename from "docs/zh/docs/Container/\345\212\250\346\200\201\345\212\240\350\275\275\345\206\205\346\240\270\346\250\241\345\235\227.md" rename to docs/zh/docs/cloud/container_form/system_container/dynamically_loading_the_kernel_module.md index 0c6b898f0..d479fab66 100644 --- "a/docs/zh/docs/Container/\345\212\250\346\200\201\345\212\240\350\275\275\345\206\205\346\240\270\346\250\241\345\235\227.md" +++ b/docs/zh/docs/cloud/container_form/system_container/dynamically_loading_the_kernel_module.md @@ -27,15 +27,15 @@ ## 约束限制 -- 如果加载的内核模块是未经过验证的,或者跟宿主机已有模块冲突的场景,会导致宿主机出现不可预知问题,在做加载内核模块时需要谨慎操作。 -- 动态加载内核模块通过将需要加载的内核模块传递给容器,此功能是依靠syscontainer-tools捕获到容器启动的环境变量实现,依赖syscontainer-tools的正确安装部署。 -- 加载的内核模块需要手动进行删除。 +- 如果加载的内核模块是未经过验证的,或者跟宿主机已有模块冲突的场景,会导致宿主机出现不可预知问题,在做加载内核模块时需要谨慎操作。 +- 动态加载内核模块通过将需要加载的内核模块传递给容器,此功能是依靠syscontainer-tools捕获到容器启动的环境变量实现,依赖syscontainer-tools的正确安装部署。 +- 加载的内核模块需要手动进行删除。 ## 使用示例 启动系统容器时,指定-e KERNEL\_MODULES参数,待系统容器启动后,可以看到ip\_vs模块被成功加载到内核中。 -``` +```sh [root@localhost ~]# lsmod | grep ip_vs [root@localhost ~]# isula run -tid -e KERNEL_MODULES=ip_vs,ip_vs_wrr --hook-spec /etc/syscontainer-tools/hookspec.json --system-container --external-rootfs /root/myrootfs none init ae18c4281d5755a1e153a7bff6b3b4881f36c8e528b9baba8a3278416a5d0980 @@ -47,7 +47,7 @@ nf_defrag_ipv6 20480 2 nf_conntrack,ip_vs libcrc32c 16384 3 nf_conntrack,nf_nat,ip_vs ``` ->![](./public_sys-resources/icon-note.gif) **说明:** ->- 宿主机需要安装syscontainer-tools。 ->- 需要指定--hooks-spec为syscontainer hooks。 - +> [!NOTE]说明 +> +> - 宿主机需要安装syscontainer-tools。 +> - 需要指定--hooks-spec为syscontainer hooks。 diff --git "a/docs/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\345\212\250\346\200\201\347\256\241\347\220\206.md" b/docs/zh/docs/cloud/container_form/system_container/dynamically_managing_container_resources_syscontainer_tools.md similarity index 99% rename from "docs/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\345\212\250\346\200\201\347\256\241\347\220\206.md" rename to docs/zh/docs/cloud/container_form/system_container/dynamically_managing_container_resources_syscontainer_tools.md index 91c2d8121..9f0e91a1c 100644 --- "a/docs/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\345\212\250\346\200\201\347\256\241\347\220\206.md" +++ b/docs/zh/docs/cloud/container_form/system_container/dynamically_managing_container_resources_syscontainer_tools.md @@ -17,7 +17,7 @@ syscontainer-tools支持将宿主机上的块设备(比如磁盘、LVM)或 ### 命令格式 ```sh -syscontainer-tools [COMMADN][OPTIONS] [ARG...] +syscontainer-tools [COMMAND][OPTIONS] [ARG...] ``` 其中: @@ -152,7 +152,7 @@ syscontainer-tools支持将宿主机上的物理网卡或虚拟网卡插入到 ### 命令格式 ```sh -syscontainer-tools [COMMADN][OPTIONS] +syscontainer-tools [COMMAND][OPTIONS] ``` 其中: @@ -243,7 +243,7 @@ container\_id:容器id。 Add network interface to container 2aaca5c1af7c (eth3,eth1) done ``` - >![](./public_sys-resources/icon-note.gif) **说明:** + >[!NOTE]说明 >添加虚拟网卡或物理网卡时,请确保网卡处于空闲状态,添加正在使用的网卡会导致系统网络断开。 ## 路由管理 @@ -255,7 +255,7 @@ syscontainer-tools工具可以对系统容器进行动态添加/删除路由表 ### 命令格式 ```sh -syscontainer-tools [COMMADN][OPTIONS] [ARG...] +syscontainer-tools [COMMAND][OPTIONS] [ARG...] ``` 其中: @@ -367,7 +367,7 @@ ARG:命令对应的参数。 ### 命令格式 ```sh -syscontainer-tools [COMMADN][OPTIONS] [ARG...] +syscontainer-tools [COMMAND][OPTIONS] [ARG...] ``` 其中: diff --git "a/docs/zh/docs/Container/\347\216\257\345\242\203\345\217\230\351\207\217\346\214\201\344\271\205\345\214\226.md" b/docs/zh/docs/cloud/container_form/system_container/environment_variable_persisting.md similarity index 90% rename from "docs/zh/docs/Container/\347\216\257\345\242\203\345\217\230\351\207\217\346\214\201\344\271\205\345\214\226.md" rename to docs/zh/docs/cloud/container_form/system_container/environment_variable_persisting.md index 1127d322c..7eeeb5c53 100644 --- "a/docs/zh/docs/Container/\347\216\257\345\242\203\345\217\230\351\207\217\346\214\201\344\271\205\345\214\226.md" +++ b/docs/zh/docs/cloud/container_form/system_container/environment_variable_persisting.md @@ -27,15 +27,15 @@ ## 约束限制 -- --env-target-file指定的目标文件如果存在的话,大小不能超过10MB。 -- --env-target-file指定的参数为rootfs目录下的绝对路径。 -- 如果--env和目标文件里面的env出现冲突,以--env指定值的参数为准。 +- --env-target-file指定的目标文件如果存在的话,大小不能超过10MB。 +- --env-target-file指定的参数为rootfs目录下的绝对路径。 +- 如果--env和目标文件里面的env出现冲突,以--env指定值的参数为准。 ## 使用示例 启动系统容器,指定env环境变量和--env-target-file参数: -``` +```sh [root@localhost ~]# isula run -tid -e abc=123 --env-target-file /etc/environment --system-container --external-rootfs /root/myrootfs none init b75df997a64da74518deb9a01d345e8df13eca6bcc36d6fe40c3e90ea1ee088e [root@localhost ~]# isula exec b7 cat /etc/environment @@ -45,4 +45,3 @@ abc=123 ``` 可以看到容器的env变量(abc=123)已经持久化到/etc/environment配置文件中。 - diff --git "a/docs/zh/docs/Container/\345\256\211\350\243\205\346\214\207\345\257\274.md" b/docs/zh/docs/cloud/container_form/system_container/installation_guideline.md similarity index 56% rename from "docs/zh/docs/Container/\345\256\211\350\243\205\346\214\207\345\257\274.md" rename to docs/zh/docs/cloud/container_form/system_container/installation_guideline.md index fcf2db30d..30c03ebbb 100644 --- "a/docs/zh/docs/Container/\345\256\211\350\243\205\346\214\207\345\257\274.md" +++ b/docs/zh/docs/cloud/container_form/system_container/installation_guideline.md @@ -1,31 +1,29 @@ # 安装指导 ->![](./public_sys-resources/icon-note.gif) **说明:** +>[!NOTE]说明 >系统容器的安装需要使用root权限。 -1. 首先需要安装iSulad容器引擎。 +1. 首先需要安装iSulad容器引擎。 - ``` + ```sh # yum install iSulad ``` -2. 安装系统容器依赖包。 +2. 安装系统容器依赖包。 - ``` + ```sh # yum install syscontainer-tools authz lxcfs-tools lxcfs ``` -3. 查看iSulad是否已经启动。 +3. 查看iSulad是否已经启动。 - ``` + ```sh # systemctl status isulad ``` -4. 开启lxcfs和authz服务。 +4. 开启lxcfs和authz服务。 - ``` + ```sh # systemctl start lxcfs # systemctl start authz ``` - - diff --git "a/docs/zh/docs/Container/\346\234\200\345\244\247\345\217\245\346\237\204\346\225\260\351\231\220\345\210\266.md" b/docs/zh/docs/cloud/container_form/system_container/maximum_number_of_handles.md similarity index 92% rename from "docs/zh/docs/Container/\346\234\200\345\244\247\345\217\245\346\237\204\346\225\260\351\231\220\345\210\266.md" rename to docs/zh/docs/cloud/container_form/system_container/maximum_number_of_handles.md index 4de230203..4b2a928cd 100644 --- "a/docs/zh/docs/Container/\346\234\200\345\244\247\345\217\245\346\237\204\346\225\260\351\231\220\345\210\266.md" +++ b/docs/zh/docs/cloud/container_form/system_container/maximum_number_of_handles.md @@ -28,14 +28,14 @@ ## 约束限制 -- 如果\--files-limit指定的值太小,可能会导致系统容器无法通过exec执行命令,报"open too many files"错误,所以files limit的值应该设置大一些。 -- 文件句柄包括普通文件句柄和网络套接字。 +- 如果\--files-limit指定的值太小,可能会导致系统容器无法通过exec执行命令,报"open too many files"错误,所以files limit的值应该设置大一些。 +- 文件句柄包括普通文件句柄和网络套接字。 ## 使用示例 使用\--files-limit限制容器内打开文件句柄数需要内核支持files cgroup,可以执行以下命令查看: -``` +```sh [root@localhost ~]# cat /proc/1/cgroup | grep files 10:files:/ ``` @@ -44,7 +44,7 @@ 容器启动指定--files-limit参数,并检查files.limit参数是否成功写入: -``` +```sh [root@localhost ~]# isula run -tid --files-limit 1024 --system-container --external-rootfs /tmp/root-fs empty init 01e82fcf97d4937aa1d96eb8067f9f23e4707b92de152328c3fc0ecb5f64e91d [root@localhost ~]# isula exec -it 01e82fcf97d4 bash [root@localhost ~]# cat /sys/fs/cgroup/files/files.limit @@ -53,4 +53,3 @@ ``` 可以看出,容器内文件句柄数被成功限制。 - diff --git "a/docs/zh/docs/Container/\347\263\273\347\273\237\345\256\271\345\231\250.md" b/docs/zh/docs/cloud/container_form/system_container/overview.md similarity index 100% rename from "docs/zh/docs/Container/\347\263\273\347\273\237\345\256\271\345\231\250.md" rename to docs/zh/docs/cloud/container_form/system_container/overview.md diff --git "a/docs/zh/docs/Container/\345\256\271\345\231\250\345\206\205reboot-shutdown.md" b/docs/zh/docs/cloud/container_form/system_container/reboot_or_shutdown_in_a_container.md similarity index 87% rename from "docs/zh/docs/Container/\345\256\271\345\231\250\345\206\205reboot-shutdown.md" rename to docs/zh/docs/cloud/container_form/system_container/reboot_or_shutdown_in_a_container.md index fed94bfad..10d6944a5 100644 --- "a/docs/zh/docs/Container/\345\256\271\345\231\250\345\206\205reboot-shutdown.md" +++ b/docs/zh/docs/cloud/container_form/system_container/reboot_or_shutdown_in_a_container.md @@ -29,29 +29,28 @@ ## 约束限制 -- shutdown功能,依赖于不同的OS,以实际容器运行环境对应OS为准。 -- 执行“shutdown -h now”命令关闭系统时,不能多次占用console。例如“isula run -ti”命令打开一个console,在另一个host bash中isula attach该容器,会打开另一个console,此时执行shutdown会失败。 +- shutdown功能,依赖于不同的OS,以实际容器运行环境对应OS为准。 +- 执行“shutdown -h now”命令关闭系统时,不能多次占用console。例如“isula run -ti”命令打开一个console,在另一个host bash中isula attach该容器,会打开另一个console,此时执行shutdown会失败。 ## 使用示例 -- 容器启动时指定\--restart on-reboot参数,示例如下: +- 容器启动时指定\--restart on-reboot参数,示例如下: - ``` + ```sh [root@localhost ~]# isula run -tid --restart on-reboot --system-container --external-rootfs /root/myrootfs none init 106faae22a926e22c828a0f2b63cf5c46e5d5986ea8a5b26de81390d0ed9714f ``` +- 进入容器执行reboot命令: -- 进入容器执行reboot命令: - - ``` + ```sh [root@localhost ~]# isula exec -it 10 bash [root@localhost /]# reboot ``` 查看容器是否重启: - ``` + ```sh [root@localhost ~]# isula exec -it 10 ps aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.1 0.0 21588 9504 ? Ss 12:11 0:00 init @@ -61,9 +60,9 @@ root 26 0.0 0.0 8092 3012 ? Rs+ 12:13 0:00 ps aux ``` -- 进入容器执行shutdown命令: +- 进入容器执行shutdown命令: - ``` + ```sh [root@localhost ~]# isula exec -it 10 bash [root@localhost /]# shutdown -h now [root@localhost /]# [root@localhost ~]# @@ -71,9 +70,7 @@ 检查容器是否停止: - ``` + ```sh [root@localhost ~]# isula exec -it 10 bash Error response from daemon: Exec container error;Container is not running:106faae22a926e22c828a0f2b63cf5c46e5d5986ea8a5b26de81390d0ed9714f ``` - - diff --git "a/docs/zh/docs/Container/\345\256\211\345\205\250\346\200\247\345\222\214\351\232\224\347\246\273\346\200\247.md" b/docs/zh/docs/cloud/container_form/system_container/security_and_isolation.md similarity index 72% rename from "docs/zh/docs/Container/\345\256\211\345\205\250\346\200\247\345\222\214\351\232\224\347\246\273\346\200\247.md" rename to docs/zh/docs/cloud/container_form/system_container/security_and_isolation.md index 7db592414..eeb0ff1c8 100644 --- "a/docs/zh/docs/Container/\345\256\211\345\205\250\346\200\247\345\222\214\351\232\224\347\246\273\346\200\247.md" +++ b/docs/zh/docs/cloud/container_form/system_container/security_and_isolation.md @@ -1,9 +1,4 @@ # 安全性和隔离性 -- [安全性和隔离性](#安全性和隔离性) - - [user namespace多对多](#user-namespace多对多) - - [用户权限控制](#用户权限控制) - - [proc文件系统隔离](#proc文件系统隔离) - ## user-namespace多对多 @@ -37,25 +32,25 @@ user namespace是将容器的root映射到主机的普通用户,使得容器 ### 约束限制 -- 如果系统容器指定了--user-remap,那么rootfs目录必须能够被--user-remap指定的uid/gid用户所访问,否则会导致容器user namespace无法访问rootfs,容器启动失败。 -- 容器内所有的id都应该能映射到主机rootfs,某些目录/文件可能是从主机mount到容器,比如/dev/pts目录下面的设备文件,如果offset值太小可能会导致mount失败。 -- uid、gid和offset的值由上层调度平台控制,容器引擎只做合法性检查。 -- --user-remap只适用于系统容器。 -- --user-remap和--privileged不能共存,否则容器启动会报错。 -- 如果uid或gid指定为0,则--user-remap参数不生效。 -- 如果系统容器指定了--user-remap,用户需保证--user-remap指定的uid/gid用户能访问isulad元数据目录(/var/lib/isulad/、/var/lib/isulad/engines/、/var/lib/isulad/engines/lcr)。 -- --user-remap与--userns不能同时使用。 +- 如果系统容器指定了--user-remap,那么rootfs目录必须能够被--user-remap指定的uid/gid用户所访问,否则会导致容器user namespace无法访问rootfs,容器启动失败。 +- 容器内所有的id都应该能映射到主机rootfs,某些目录/文件可能是从主机mount到容器,比如/dev/pts目录下面的设备文件,如果offset值太小可能会导致mount失败。 +- uid、gid和offset的值由上层调度平台控制,容器引擎只做合法性检查。 +- --user-remap只适用于系统容器。 +- --user-remap和--privileged不能共存,否则容器启动会报错。 +- 如果uid或gid指定为0,则--user-remap参数不生效。 +- 如果系统容器指定了--user-remap,用户需保证--user-remap指定的uid/gid用户能访问isulad元数据目录(/var/lib/isulad/、/var/lib/isulad/engines/、/var/lib/isulad/engines/lcr)。 +- --user-remap与--userns不能同时使用。 ### 使用指导 ->![](./public_sys-resources/icon-note.gif) **说明:** +>[!NOTE]说明 >指定--user-remap参数前,请先将rootfs下所有目录和文件的uid和gid做整体偏移,偏移量为--user-remap指定uid和gid的偏移量。 >例如将dev目录的uid和gid整体uid和gid偏移100000的参考命令为: >chown 100000:100000 dev 系统容器启动指定--user-remap参数: -``` +```sh [root@localhost ~]# chmod 751 /var/lib/isulad/ [root@localhost ~]# chmod 751 /var/lib/isulad/engines/ [root@localhost ~]# chmod 751 /var/lib/isulad/engines/lcr @@ -65,7 +60,7 @@ eb9605b3b56dfae9e0b696a729d5e1805af900af6ce24428fde63f3b0a443f4a 分别在宿主机和容器内查看/sbin/init进程信息: -``` +```sh [root@localhost ~]# isula exec eb ps aux | grep /sbin/init root 1 0.6 0.0 21624 9624 ? Ss 15:47 0:00 /sbin/init [root@localhost ~]# ps aux | grep /sbin/init @@ -77,7 +72,7 @@ root 4948 0.0 0.0 213032 808 pts/0 S+ 15:48 0:00 grep --color=au 在容器内创建一个文件,然后在宿主机上查看文件的owner: -``` +```sh [root@localhost ~]# isula exec -it eb bash [root@localhost /]# echo test123 >> /test123 [root@localhost /]# exit @@ -119,24 +114,24 @@ exit ### 约束限制 -- authz需要配置用户权限策略,策略文件默认为/var/lib/authz-broker/policy.json,该配置文件支持动态修改,修改完即时生效,不需要重启插件服务。 -- 由于容器引擎为root用户启动,放开一般用户使用的一些命令可能会导致该用户不当获得过大权限,需谨慎配置。目前container\_attach、container\_create和container\_exec\_create动作可能会有风险。 -- 对于某些复合操作,比如isula exec、isula attach等命令依赖isula inspect是否有权限,如果用户没有inspect权限会直接报错。 -- 采用SSL/TLS 加密通道在增加安全性的同时也会带来性能损耗,如增加延时,消耗较多的CPU资源,除了数据传输外,加解密需要更大吞吐量,因此在并发场景下,相比非TLS通信,其并发量有一定程度上的下降。经实测,在ARM服务器(Cortex-A72 64核)接近空载情况下,采用TLS并发起容器,其最大并发量在200\~250范围内。 -- 服务端指定--tlsverify时,认证文件默认配置路径为/etc/isulad。且默认文件名分别为ca.pem、cert.pem、key.pem。 +- authz需要配置用户权限策略,策略文件默认为/var/lib/authz-broker/policy.json,该配置文件支持动态修改,修改完即时生效,不需要重启插件服务。 +- 由于容器引擎为root用户启动,放开一般用户使用的一些命令可能会导致该用户不当获得过大权限,需谨慎配置。目前container\_attach、container\_create和container\_exec\_create动作可能会有风险。 +- 对于某些复合操作,比如isula exec、isula attach等命令依赖isula inspect是否有权限,如果用户没有inspect权限会直接报错。 +- 采用SSL/TLS 加密通道在增加安全性的同时也会带来性能损耗,如增加延时,消耗较多的CPU资源,除了数据传输外,加解密需要更大吞吐量,因此在并发场景下,相比非TLS通信,其并发量有一定程度上的下降。经实测,在ARM服务器(Cortex-A72 64核)接近空载情况下,采用TLS并发起容器,其最大并发量在200\~250范围内。 +- 服务端指定--tlsverify时,认证文件默认配置路径为/etc/isulad。且默认文件名分别为ca.pem、cert.pem、key.pem。 ### 使用示例 -1. 确认宿主机安装了authz插件,如果需要安装,安装并启动authz插件服务命令如下: +1. 确认宿主机安装了authz插件,如果需要安装,安装并启动authz插件服务命令如下: - ``` + ```sh [root@localhost ~]# yum install authz [root@localhost ~]# systemctl start authz ``` -2. 要启动该功能,首先需要配置容器引擎和用户的TLS证书。可以使用OPENSSL来生成需要的证书,具体步骤如下: +2. 要启动该功能,首先需要配置容器引擎和用户的TLS证书。可以使用OPENSSL来生成需要的证书,具体步骤如下: - ``` + ```sh #SERVERSIDE # Generate CA key @@ -164,9 +159,9 @@ exit 若要直接使用以上过程作为脚本,需替换各变量为配置数值。生成CA时使用的参数若为空则写为“''”。PASSWORD、COMMON\_NAME、CLIENT\_NAME、VALIDITY为必选项。 -3. 容器引擎启动时添加TLS相关参数和认证插件相关参数,并保证认证插件的运行。此外,为了使用TLS认证,容器引擎必须使用TCP侦听的方式启动,不能使用传统的unix socket的方式启动。容器daemon端配置如下: +3. 容器引擎启动时添加TLS相关参数和认证插件相关参数,并保证认证插件的运行。此外,为了使用TLS认证,容器引擎必须使用TCP侦听的方式启动,不能使用传统的unix socket的方式启动。容器daemon端配置如下: - ``` + ```con { "tls": true, "tls-verify": true, @@ -179,37 +174,36 @@ exit } ``` -4. 然后需要配置策略,对于基本授权流程,所有策略都位于一个配置文件下/var/lib/authz-broker/policy.json。该配置文件支持动态修改,更改时不需要重新启动插件,只需要向authz进程发送SIGHUP信号。文件格式是每行一个策略JSON对象。每行只有一个匹配。具体的策略配置示例如下: +4. 然后需要配置策略,对于基本授权流程,所有策略都位于一个配置文件下/var/lib/authz-broker/policy.json。该配置文件支持动态修改,更改时不需要重新启动插件,只需要向authz进程发送SIGHUP信号。文件格式是每行一个策略JSON对象。每行只有一个匹配。具体的策略配置示例如下: - - 所有用户都可以运行所有iSulad命令:\{"name":"policy\_0","users":\[""\],"actions":\[""\]\}。 - - Alice可以运行所有iSulad命令:\{"name":"policy\_1","users":\["alice"\],"actions":\[""\]\}。 - - 空用户都可以运行所有iSulad命令: \{"name":"policy\_2","users":\[""\],"actions":\[""\]\}。 - - Alice和Bob可以创建新的容器:\{"name":"policy\_3","users":\["alice","bob"\],"actions":\["container\_create"\]\}。 - - service\_account可以读取日志并运行docker top:\{"name":"policy\_4","users":\["service\_account"\],"actions":\["container\_logs","container\_top"\]\}。 - - Alice可以执行任何container操作:\{"name":"policy\_5","users":\["alice"\],"actions":\["container"\]\}。 - - Alice可以执行任何container操作,但请求的种类只能是get:\{"name":"policy\_5","users":\["alice"\],"actions":\["container"\], "readonly":true \}。 + - 所有用户都可以运行所有iSulad命令:\{"name":"policy\_0","users":\[""\],"actions":\[""\]\}。 + - Alice可以运行所有iSulad命令:\{"name":"policy\_1","users":\["alice"\],"actions":\[""\]\}。 + - 空用户都可以运行所有iSulad命令: \{"name":"policy\_2","users":\[""\],"actions":\[""\]\}。 + - Alice和Bob可以创建新的容器:\{"name":"policy\_3","users":\["alice","bob"\],"actions":\["container\_create"\]\}。 + - service\_account可以读取日志并运行docker top:\{"name":"policy\_4","users":\["service\_account"\],"actions":\["container\_logs","container\_top"\]\}。 + - Alice可以执行任何container操作:\{"name":"policy\_5","users":\["alice"\],"actions":\["container"\]\}。 + - Alice可以执行任何container操作,但请求的种类只能是get:\{"name":"policy\_5","users":\["alice"\],"actions":\["container"\], "readonly":true \}。 - >![](./public_sys-resources/icon-note.gif) **说明:** - >- 配置中匹配action支持正则表达式。 - >- users不支持正则表达式。 - >- users不能有重复用户,即同一用户不能被多条规则匹配。 + >[!NOTE]说明 + >- 配置中匹配action支持正则表达式。 + >- users不支持正则表达式。 + >- users不能有重复用户,即同一用户不能被多条规则匹配。 -5. 配置并更新完之后,客户端配置TLS参数连接容器引擎,即是以受限的权限访问。 +5. 配置并更新完之后,客户端配置TLS参数连接容器引擎,即是以受限的权限访问。 - ``` + ```sh [root@localhost ~]# isula version --tlsverify --tlscacert=/root/.iSulad/ca.pem --tlscert=/root/.iSulad/cert.pem --tlskey=/root/.iSulad/key.pem -H=tcp://127.0.0.1:2375 ``` 如果想默认配置TLS认证进行客户端连接,可以将文件移动到\~/.iSulad,并设置 ISULAD\_HOST和ISULAD\_TLS\_VERIFY变量(而不是每次调用时传递 -H=tcp://$HOST:2375和--tlsverify)。 - ``` + ```sh [root@localhost ~]# mkdir -pv ~/.iSulad [root@localhost ~]# cp -v {ca,cert,key}.pem ~/.iSulad [root@localhost ~]# export ISULAD_HOST=localhost:2375 ISULAD_TLS_VERIFY=1 [root@localhost ~]# isula version ``` - ## proc文件系统隔离 ### 场景描述 @@ -222,7 +216,7 @@ exit lxcfs-tools命令行格式如下: -``` +```sh lxcfs-tools [OPTIONS] COMMAND [COMMAND_OPTIONS] ``` @@ -270,34 +264,33 @@ lxcfs-tools [OPTIONS] COMMAND [COMMAND_OPTIONS] ### 约束限制 -- 当前只支持proc文件系统下的cpuinfo, meminfo, stat, diskstats, partitions,swaps和uptime文件,其他的文件和其他内核API文件系统(比如sysfs)未做隔离 。 -- 安装rpm包后会在/var/lib/isulad/hooks/hookspec.json生成样例json文件,用户如果需要增加日志功能,需要在定制时加入--log配置。 -- diskstats只能显示支持cfq调度的磁盘信息,无法显示分区信息。容器内设备会被显示为/dev目录下的名字。若不存在则为空。此外,容器根目录所在设备会被显示为sda。 -- 挂载lxcfs时必须使用slave参数。若使用shared参数,可能会导致容器内挂载点泄露到主机,影响主机运行 。 -- lxcfs支持服务优雅降级使用,若lxcfs服务crash或者不可用,容器内查看到的cpuinfo, meminfo, stat, diskstats, partitions, swaps和uptime均为host信息,容器其他业务功能不受影响。 -- lxcfs底层依赖fuse内核模块以及libfuse库,因此需要内核支持fuse。 -- lxcfs当前仅支持容器内运行64位的app,如果容器内运行32位的app可能会导致app读取到的cpuinfo信息不符合预期。 -- lxcfs只是对容器cgroup进行资源视图模拟,对于容器内的系统调用(例如sysconf)获取到的仍然是主机的信息,lxcfs无法做到内核隔离。 -- lxcfs使用隔离后的cpuinfo显示的cpu信息具有如下特征: - - processor:从0开始依次递增。 - - physical id:从0开始依次递增。 - - sibliing:固定为1。 - - core id:固定为0。 - - cpu cores:固定为1。 - +- 当前只支持proc文件系统下的cpuinfo, meminfo, stat, diskstats, partitions,swaps和uptime文件,其他的文件和其他内核API文件系统(比如sysfs)未做隔离 。 +- 安装rpm包后会在/var/lib/isulad/hooks/hookspec.json生成样例json文件,用户如果需要增加日志功能,需要在定制时加入--log配置。 +- diskstats只能显示支持cfq调度的磁盘信息,无法显示分区信息。容器内设备会被显示为/dev目录下的名字。若不存在则为空。此外,容器根目录所在设备会被显示为sda。 +- 挂载lxcfs时必须使用slave参数。若使用shared参数,可能会导致容器内挂载点泄露到主机,影响主机运行 。 +- lxcfs支持服务优雅降级使用,若lxcfs服务crash或者不可用,容器内查看到的cpuinfo, meminfo, stat, diskstats, partitions, swaps和uptime均为host信息,容器其他业务功能不受影响。 +- lxcfs底层依赖fuse内核模块以及libfuse库,因此需要内核支持fuse。 +- lxcfs当前仅支持容器内运行64位的app,如果容器内运行32位的app可能会导致app读取到的cpuinfo信息不符合预期。 +- lxcfs只是对容器cgroup进行资源视图模拟,对于容器内的系统调用(例如sysconf)获取到的仍然是主机的信息,lxcfs无法做到内核隔离。 +- lxcfs使用隔离后的cpuinfo显示的cpu信息具有如下特征: + - processor:从0开始依次递增。 + - physical id:从0开始依次递增。 + - sibliing:固定为1。 + - core id:固定为0。 + - cpu cores:固定为1。 ### 使用示例 -1. 首先需要安装lxcfs和lxcfs-tools这两个包,并启动lxcfs服务。 +1. 首先需要安装lxcfs和lxcfs-tools这两个包,并启动lxcfs服务。 - ``` + ```sh [root@localhost ~]# yum install lxcfs lxcfs-tools [root@localhost ~]# systemctl start lxcfs ``` -2. 容器启动完成之后查看容器内是否存在lxcfs挂载点。 +2. 容器启动完成之后查看容器内是否存在lxcfs挂载点。 - ``` + ```sh [root@localhost ~]# isula run -tid -v /var/lib/lxc:/var/lib/lxc --hook-spec /var/lib/isulad/hooks/hookspec.json --system-container --external-rootfs /home/root-fs none init a8acea9fea1337d9fd8270f41c1a3de5bceb77966e03751346576716eefa9782 [root@localhost ~]# isula exec a8 mount | grep lxcfs @@ -311,9 +304,9 @@ lxcfs-tools [OPTIONS] COMMAND [COMMAND_OPTIONS] lxcfs on /proc/uptime type fuse.lxcfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other) ``` -3. 执行update命令更新容器的cpu和mem资源配置,然后查看容器资源。根据如下回显可知,容器资源视图显示的是容器真实资源数据而不是宿主机的数据。 +3. 执行update命令更新容器的cpu和mem资源配置,然后查看容器资源。根据如下回显可知,容器资源视图显示的是容器真实资源数据而不是宿主机的数据。 - ``` + ```sh [root@localhost ~]# isula update --cpuset-cpus 0-1 --memory 1G a8 a8 [root@localhost ~]# isula exec a8 cat /proc/cpuinfo @@ -342,5 +335,3 @@ lxcfs-tools [OPTIONS] COMMAND [COMMAND_OPTIONS] Mem: 1024 17 997 7 8 1006 Swap: 4095 0 4095 ``` - - diff --git "a/docs/zh/docs/Container/\345\205\261\344\272\253\345\206\205\345\255\230\351\200\232\351\201\223.md" b/docs/zh/docs/cloud/container_form/system_container/shared_memory_channels.md similarity index 80% rename from "docs/zh/docs/Container/\345\205\261\344\272\253\345\206\205\345\255\230\351\200\232\351\201\223.md" rename to docs/zh/docs/cloud/container_form/system_container/shared_memory_channels.md index ec3b77a3b..68e9a48c2 100644 --- "a/docs/zh/docs/Container/\345\205\261\344\272\253\345\206\205\345\255\230\351\200\232\351\201\223.md" +++ b/docs/zh/docs/cloud/container_form/system_container/shared_memory_channels.md @@ -32,15 +32,15 @@ ## 约束限制 -- 宿主机上挂载的tmpfs的生命周期为从容器启动到容器删除,容器删除并解除对空间的占用后会移除这片空间。 -- 容器删除时会将宿主机上挂载tmpfs的路径删除,所以不允许使用宿主机上已存在的目录。 -- 为了宿主机上非root用户运行的进程能够与容器内进行通信,宿主机上tmpfs挂载的权限为1777。 +- 宿主机上挂载的tmpfs的生命周期为从容器启动到容器删除,容器删除并解除对空间的占用后会移除这片空间。 +- 容器删除时会将宿主机上挂载tmpfs的路径删除,所以不允许使用宿主机上已存在的目录。 +- 为了宿主机上非root用户运行的进程能够与容器内进行通信,宿主机上tmpfs挂载的权限为1777。 ## 使用示例 创建容器时指定\--host-channel参数: -``` +```sh [root@localhost ~]# isula run --rm -it --host-channel /testdir:/testdir:rw:32M --system-container --external-rootfs /root/myrootfs none init root@3b947668eb54:/# dd if=/dev/zero of=/testdir/test.file bs=1024 count=64K dd: error writing '/testdir/test.file': No space left on device @@ -49,8 +49,8 @@ dd: error writing '/testdir/test.file': No space left on device 33554432 bytes (34 MB, 32 MiB) copied, 0.0766899 s, 438 MB/s ``` ->![](./public_sys-resources/icon-note.gif) **说明:** ->- 使用--host-channel大小限制时,若在容器内创建共享文件,则会受到容器内的内存配额限制(在容器内存使用达到极限时可能会产生oom)。 ->- 若用户在主机端创建共享文件,则不受容器内的内存配额限制。 ->- 若用户需要在容器内创建共享文件,且业务为内存密集型,可以通过设置容器内存配额为在原本基础上加上--host-channel配置的大小来消除影响。 - +> [!NOTE]说明 +> +> - 使用--host-channel大小限制时,若在容器内创建共享文件,则会受到容器内的内存配额限制(在容器内存使用达到极限时可能会产生oom)。 +> - 若用户在主机端创建共享文件,则不受容器内的内存配额限制。 +> - 若用户需要在容器内创建共享文件,且业务为内存密集型,可以通过设置容器内存配额为在原本基础上加上--host-channel配置的大小来消除影响。 diff --git "a/docs/zh/docs/Container/\346\214\207\345\256\232rootfs\345\210\233\345\273\272\345\256\271\345\231\250.md" b/docs/zh/docs/cloud/container_form/system_container/specifying_rootfs_to_create_a_container.md similarity index 79% rename from "docs/zh/docs/Container/\346\214\207\345\256\232rootfs\345\210\233\345\273\272\345\256\271\345\231\250.md" rename to docs/zh/docs/cloud/container_form/system_container/specifying_rootfs_to_create_a_container.md index d5e3f4f9f..fff0d4299 100644 --- "a/docs/zh/docs/Container/\346\214\207\345\256\232rootfs\345\210\233\345\273\272\345\256\271\345\231\250.md" +++ b/docs/zh/docs/cloud/container_form/system_container/specifying_rootfs_to_create_a_container.md @@ -27,20 +27,19 @@ ## 约束限制 -- 参数--external-rootfs指定的rootfs目录必须为绝对路径,不能为相对路径。 -- 参数--external-rootfs指定的rootfs目录必须为一个完整运行的操作系统环境(包含systemd软件包),否则容器会启动失败。 -- 容器删除时,不会删除--external-rootfs指定的rootfs目录。 -- 不支持在x86环境上运行基于arm rootfs的容器,也不支持在arm环境上运行基于x86 rootfs的容器。 -- 同一份rootfs,不建议启动多个容器实例,即同一份rootfs只供一个生命周期内的容器实例使用。 +- 参数--external-rootfs指定的rootfs目录必须为绝对路径,不能为相对路径。 +- 参数--external-rootfs指定的rootfs目录必须为一个完整运行的操作系统环境(包含systemd软件包),否则容器会启动失败。 +- 容器删除时,不会删除--external-rootfs指定的rootfs目录。 +- 不支持在x86环境上运行基于arm rootfs的容器,也不支持在arm环境上运行基于x86 rootfs的容器。 +- 同一份rootfs,不建议启动多个容器实例,即同一份rootfs只供一个生命周期内的容器实例使用。 ## 使用示例 假设本地rootfs的路径为/root/myrootfs,那么启动一个系统容器的命令如下: -``` +```sh # isula run -tid --system-container --external-rootfs /root/myrootfs none init ``` ->![](./public_sys-resources/icon-note.gif) **说明:** +>[!NOTE]说明 >rootfs为自定义的文件系统,请用户自行准备。例如容器镜像的tar包解压后,即为一个rootfs。 - diff --git "a/docs/zh/docs/Container/\344\275\277\347\224\250\346\214\207\345\215\227-1.md" b/docs/zh/docs/cloud/container_form/system_container/usage_guide.md similarity index 93% rename from "docs/zh/docs/Container/\344\275\277\347\224\250\346\214\207\345\215\227-1.md" rename to docs/zh/docs/cloud/container_form/system_container/usage_guide.md index 941c53b85..5ea4272b0 100644 --- "a/docs/zh/docs/Container/\344\275\277\347\224\250\346\214\207\345\215\227-1.md" +++ b/docs/zh/docs/cloud/container_form/system_container/usage_guide.md @@ -16,5 +16,5 @@ - COMMAND:系统容器启动后执行的命令。 - ARG:系统容器启动后执行命令对应的参数。 ->![](./public_sys-resources/icon-note.gif) **说明:** +>[!NOTE]说明 >系统容器的使用需要root权限。 diff --git "a/docs/zh/docs/Container/\351\200\232\350\277\207systemd\345\220\257\345\212\250\345\256\271\345\231\250.md" b/docs/zh/docs/cloud/container_form/system_container/using_systemd_to_start_a_container.md similarity index 100% rename from "docs/zh/docs/Container/\351\200\232\350\277\207systemd\345\220\257\345\212\250\345\256\271\345\231\250.md" rename to docs/zh/docs/cloud/container_form/system_container/using_systemd_to_start_a_container.md diff --git "a/docs/zh/docs/Container/namespace\345\214\226\345\206\205\346\240\270\345\217\202\346\225\260\345\217\257\345\206\231.md" b/docs/zh/docs/cloud/container_form/system_container/writable_namespace_kernel_parameters.md similarity index 98% rename from "docs/zh/docs/Container/namespace\345\214\226\345\206\205\346\240\270\345\217\202\346\225\260\345\217\257\345\206\231.md" rename to docs/zh/docs/cloud/container_form/system_container/writable_namespace_kernel_parameters.md index 7cc7807d1..3b98553c9 100644 --- "a/docs/zh/docs/Container/namespace\345\214\226\345\206\205\346\240\270\345\217\202\346\225\260\345\217\257\345\206\231.md" +++ b/docs/zh/docs/cloud/container_form/system_container/writable_namespace_kernel_parameters.md @@ -8,8 +8,6 @@ 在允许用户在容器内修改时,部分内核参数是全局有效的,某个容器修改后,会影响主机上所有的程序,安全性降低。 -   - 系统容器提供--ns-change-opt参数,可以指定namespace化的内核参数在容器内动态设置,当前仅支持net、ipc。 ## 参数说明 @@ -50,13 +48,13 @@ ## 约束限制 -- 如果容器启动同时指定了--privileged(特权容器)和--ns-change-opt,则--ns-change-opt不生效。 +- 如果容器启动同时指定了--privileged(特权容器)和--ns-change-opt,则--ns-change-opt不生效。 ## 使用示例 启动容器, 指定--ns-change-opt=net: -``` +```sh [root@localhost ~]# isula run -tid --ns-change-opt net --system-container --external-rootfs /root/myrootfs none init 4bf44a42b4a14fdaf127616c90defa64b4b532b18efd15b62a71cbf99ebc12d2 [root@localhost ~]# isula exec -it 4b mount | grep /proc/sys @@ -69,7 +67,7 @@ proc on /proc/sys/net type proc (rw,nosuid,nodev,noexec,relatime) 再启动一个容器,指定--ns-change-opt=ipc: -``` +```sh [root@localhost ~]# isula run -tid --ns-change-opt ipc --system-container --external-rootfs /root/myrootfs none init c62e5e5686d390500dab2fa76b6c44f5f8da383a4cbbeac12cfada1b07d6c47f [root@localhost ~]# isula exec -it c6 mount | grep /proc/sys @@ -87,4 +85,3 @@ proc on /proc/sys/fs/mqueue type proc (rw,nosuid,nodev,noexec,relatime) ``` 可以看到容器内ipc相关的内核参数挂载点为rw,说明ipc相关的namespace化的内核参数具有读写权限。 - -- Gitee