Shared Memory Channels

Function Description

System containers enable the communication between container and host processes through shared memory. You can set the –host-channel parameter when creating a container to allow the host to share the same tmpfs with the container so that they can communicate with each other.

Parameter Description

Command

Parameter

Value Description

isula create/run

--host-channel

  • Variable of the string type. Its format is as follows:
    <host path>:<container path>:<rw/ro>:<size limit>
  • The parameter is described as follows:

    <host path>: path to which tmpfs is mounted on the host, which must be an absolute path.

    <container path>: path to which tmpfs is mounted in a container, which must be an absolute path.

    <rw/ro>: permissions on the file system mounted to the container. The value can only be rw (read and write) or ro (read only). The default value is rw.

    <size limit>: maximum size used by the mounted tmpfs. The minimum value is one 4 KB physical page, and the maximum value is half of the total physical memory in the system. The default value is 64MB.

Constraints

  • The lifecycle of tmpfs mounted on the host starts from the container startup to the container deletion. After a container is deleted and its occupied space is released, the space is removed.
  • When a container is deleted, the path to which tmpfs is mounted on the host is deleted. Therefore, an existing directory on the host cannot be used as the mount path.
  • To ensure that processes running by non-root users on the host can communicate with containers, the permission for tmpfs mounted on the host is 1777.

Example

Specify the –host-channel parameter when creating a container.

[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 
32769+0 records in 
32768+0 records out 
33554432 bytes (34 MB, 32 MiB) copied, 0.0766899 s, 438 MB/s

NOTE:

  • If –host-channel is used for size limit, the file size is constrained by the memory limit in the container. (The OOM error may occur when the memory usage reaches the upper limit.)
  • If a user creates a shared file on the host, the file size is not constrained by the memory limit in the container.
  • If you need to create a shared file in the container and the service is memory-intensive, you can add the value of –host-channel to the original value of the container memory limit, eliminating the impact.

有奖捉虫

“有虫”文档片段

存在的问题

提交类型 issue
有点复杂...
找人问问吧。
PR
小问题,全程线上修改...
一键搞定!
问题类型
规范和低错类

● 错别字或拼写错误;标点符号使用错误;

● 链接错误、空单元格、格式错误;

● 英文中包含中文字符;

● 界面和描述不一致,但不影响操作;

● 表述不通顺,但不影响理解;

● 版本号不匹配:如软件包名称、界面版本号;

易用性

● 关键步骤错误或缺失,无法指导用户完成任务;

● 缺少必要的前提条件、注意事项等;

● 图形、表格、文字等晦涩难懂;

● 逻辑不清晰,该分类、分项、分步骤的没有给出;

正确性

● 技术原理、功能、规格等描述和软件不一致,存在错误;

● 原理图、架构图等存在错误;

● 命令、命令参数等错误;

● 代码片段错误;

● 命令无法完成对应功能;

● 界面错误,无法指导操作;

风险提示

● 对重要数据或系统存在风险的操作,缺少安全提示;

内容合规

● 违反法律法规,涉及政治、领土主权等敏感词;

● 内容侵权;

您对文档的总体满意度

非常不满意
非常满意
创Issue赢奖品
根据您的反馈,会自动生成issue模板。您只需点击按钮,创建issue即可。