From 33afec96c3445da859c7a1c6e45fe8bd7139dc89 Mon Sep 17 00:00:00 2001 From: lifeng68 Date: Thu, 28 May 2020 14:36:23 +0800 Subject: [PATCH] docs: use normal user in docs Signed-off-by: lifeng68 --- ...71\345\231\250\347\256\241\347\220\206.md" | 36 +++++++++---------- ...04\346\272\220\347\256\241\347\220\206.md" | 18 +++++----- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git "a/content/zh/docs/Container/\345\256\271\345\231\250\347\256\241\347\220\206.md" "b/content/zh/docs/Container/\345\256\271\345\231\250\347\256\241\347\220\206.md" index 909651ea4..ad540496b 100644 --- "a/content/zh/docs/Container/\345\256\271\345\231\250\347\256\241\347\220\206.md" +++ "b/content/zh/docs/Container/\345\256\271\345\231\250\347\256\241\347\220\206.md" @@ -688,11 +688,11 @@ run命令支持参数参考下表。 - 禁止使用echo的方式向run命令的stdin输入数据,会导致客户端卡死。应该直接将echo的值作为命令行参数传给容器 ``` - [root@localhost ~]# echo ls | isula run -i busybox /bin/sh + $ echo ls | isula run -i busybox /bin/sh ^C - [root@localhost ~]# + $ ``` 上述命令出现客户端卡死现象,这是由于上述命令相当于往stdin输入ls,随后EOF被读取,客户端不再发送数据,等待服务端退出,但是服务端无法区分客户端是否需要继续发送数据,因而服务端卡在read数据上,最终导致双方均卡死。 @@ -700,7 +700,7 @@ run命令支持参数参考下表。 正确的执行方式为: ``` - [root@localhost ~]# isula run -i busybox ls + $ isula run -i busybox ls bin dev etc @@ -711,7 +711,7 @@ run命令支持参数参考下表。 tmp usr var - [root@localhost ~]# + $ ``` - 使用host的根目录(/)作为容器的文件系统,那么在挂载路径时,如果有如下情况 @@ -1147,28 +1147,28 @@ exec命令支持参数参考下表。 原因:使用exec 执行ls /test,输出带有换行,针对该输出进行“| grep "xx" | wc -l“,处理结果为2(两行) ``` - [root@localhost ~]# isula exec -it container ls /test + $ isula exec -it container ls /test xx xx10 xx12 xx14 xx3 xx5 xx7 xx9 xx1 xx11 xx13 xx2 xx4 xx6 xx8 - [root@localhost ~]# + $ ``` 建议处理方式:使用run/exec执行带有管道操作的命令时,使用/bin/bash -c 执行命令,在容器中执行管道操作。 ``` - [root@localhost ~]# isula exec -it container /bin/sh -c "ls /test | grep "xx" | wc -l" + $ isula exec -it container /bin/sh -c "ls /test | grep "xx" | wc -l" 15 - [root@localhost ~]# + $ ``` - 禁止使用echo的方式向exec命令的stdin输入数据,会导致客户端卡死。应该直接将echo的值作为命令行参数传给容器 ``` - [root@localhost ~]# echo ls | isula exec 38 /bin/sh + $ echo ls | isula exec 38 /bin/sh ^C - [root@localhost ~]# + $ ``` 上述命令可能出现客户端卡死现象,这是由于上述命令相当于往stdin输入ls,随后EOF被读取,客户端不再发送数据,等待服务端退出,但是服务端无法区分客户端是否需要继续发送数据,因而服务端卡在read数据上,最终导致双方均卡死。 @@ -1176,7 +1176,7 @@ exec命令支持参数参考下表。 正确的执行方式为: ``` - [root@localhost ~]# isula exec 38 ls + $ isula exec 38 ls bin dev etc home proc root sys tmp usr var ``` @@ -1783,18 +1783,18 @@ cp命令支持参数参考下表。 - iSulad在执行拷贝时,不会挂载/etc/hostname, /etc/resolv.conf,/etc/hosts三个文件,也不会对--volume和--mount参数传入的参数挂载到host,所以对这些文件的拷贝使用的是镜像中的原始文件,而不是真实容器中的文件。 ``` - [root@localhost tmp]# isula cp b330e9be717a:/etc/hostname /tmp/hostname - [root@localhost tmp]# cat /tmp/hostname - [root@localhost tmp]# + $ isula cp b330e9be717a:/etc/hostname /tmp/hostname + $ cat /tmp/hostname + $ ``` - iSulad在解压文件时,不会对文件系统中即将被覆盖的文件或文件夹做类型判断,而是直接覆盖,所以在拷贝时,如果源为文件夹,同名的文件会被强制覆盖为文件夹;如果源为文件,同名的文件夹会被强制覆盖为文件。 ``` - [root@localhost tmp]# rm -rf /tmp/test_file_to_dir && mkdir /tmp/test_file_to_dir - [root@localhost tmp]# isula exec b330e9be717a /bin/sh -c "rm -rf /tmp/test_file_to_dir && touch /tmp/test_file_to_dir" - [root@localhost tmp]# isula cp b330e9be717a:/tmp/test_file_to_dir /tmp - [root@localhost tmp]# ls -al /tmp | grep test_file_to_dir + $ rm -rf /tmp/test_file_to_dir && mkdir /tmp/test_file_to_dir + $ isula exec b330e9be717a /bin/sh -c "rm -rf /tmp/test_file_to_dir && touch /tmp/test_file_to_dir" + $ isula cp b330e9be717a:/tmp/test_file_to_dir /tmp + $ ls -al /tmp | grep test_file_to_dir -rw-r----- 1 root root 0 Apr 26 09:59 test_file_to_dir ``` diff --git "a/content/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\347\256\241\347\220\206.md" "b/content/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\347\256\241\347\220\206.md" index f3614c093..c7220401d 100644 --- "a/content/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\347\256\241\347\220\206.md" +++ "b/content/zh/docs/Container/\345\256\271\345\231\250\350\265\204\346\272\220\347\256\241\347\220\206.md" @@ -360,7 +360,7 @@ create/run时指定--storage-opt参数。 在isula run/create命令行上通过已有参数“--storage-opt size=”来设置限额。其中value是一个正数,单位可以是\[kKmMgGtTpP\]?\[iI\]?\[bB\]?,在不带单位的时候默认单位是字节。 ``` -$ [root@localhost ~]# isula run -ti --storage-opt size=10M busybox +$ isula run -ti --storage-opt size=10M busybox / # df -h Filesystem Size Used Available Use% Mounted on overlay 10.0M 48.0K 10.0M 0% / @@ -405,7 +405,7 @@ overlay 10.0M 10.0M 0 100% / 内核必须支持ext4的project quota功能,并在mkfs的时候要加上-O quota,project,挂载的时候要加上-o prjquota。任何一个不满足,在使用--storage-opt size=时都将报错。 ``` - $ [root@localhost ~]# isula run -it --storage-opt size=10Mb busybox df -h + $ isula run -it --storage-opt size=10Mb busybox df -h Error response from daemon: Failed to prepare rootfs with error: time="2019-04-09T05:13:52-04:00" level=fatal msg="error creating read- write layer with ID "a4c0e55e82c55e4ee4b0f4ee07f80cc2261cf31b2c2dfd628fa1fb00db97270f": --storage-opt is supported only for overlay over xfs or ext4 with 'pquota' mount option" @@ -425,7 +425,7 @@ overlay 10.0M 10.0M 0 100% / docker启动失败。 ``` - [root@localhost ~]# docker run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest + $ docker run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest docker: Error response from daemon: symlink /proc/mounts /var/lib/docker/overlay2/e6e12701db1a488636c881b44109a807e187b8db51a50015db34a131294fcf70-init/merged/etc/mtab: disk quota exceeded. See 'docker run --help'. ``` @@ -433,9 +433,9 @@ overlay 10.0M 10.0M 0 100% / 轻量级容器不报错,正常启动 ``` - [root@localhost ~]# isula run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest + $ isula run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest 636480b1fc2cf8ac895f46e77d86439fe2b359a1ff78486ae81c18d089bbd728 - [root@localhost ~]# isula ps + $ isula ps STATUS PID IMAGE COMMAND EXIT_CODE RESTART_COUNT STARTAT FINISHAT RUNTIME ID NAMES running 17609 rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest /bin/bash 0 0 2 seconds ago - lcr 636480b1fc2c 636480b1fc2cf8ac895f46e77d86439fe2b359a1ff78486ae81c18d089bbd728 ``` @@ -447,7 +447,7 @@ overlay 10.0M 10.0M 0 100% / 轻量级容器在启动容器过程中,使用默认配置时,挂载点较少,如/proc,或/sys等路径不存在时,才会创建。用例中的镜像rnd-dockerhub.huawei.com/official/ubuntu-arm64:latest本身含有/proc, /sys等,因此整个启动容器的过程中,都不会有新文件或路径生成,故轻量级容器启动过程不会报错。为验证这一过程,当把镜像替换为rnd-dockerhub.huawei.com/official/busybox-aarch64:latest时,由于该镜像内无/proc存在,轻量级容器启动一样会报错。 ``` - [root@localhost ~]# isula run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/busybox-aarch64:latest + $ isula run -itd --storage-opt size=4k rnd-dockerhub.huawei.com/official/busybox-aarch64:latest 8e893ab483310350b8caa3b29eca7cd3c94eae55b48bfc82b350b30b17a0aaf4 Error response from daemon: Start container error: runtime error: 8e893ab483310350b8caa3b29eca7cd3c94eae55b48bfc82b350b30b17a0aaf4:tools/lxc_start.c:main:404 starting container process caused "Failed to setup lxc, please check the config file." @@ -512,7 +512,7 @@ isula run -ti --files-limit 1024 busybox bash 1. 使用--files-limit参数传入一个很小的值,如1,可能导致容器启动失败。 ``` - [root@localhost ~]# isula run -itd --files-limit 1 rnd-dockerhub.huawei.com/official/busybox-aarch64 + $ isula run -itd --files-limit 1 rnd-dockerhub.huawei.com/official/busybox-aarch64 004858d9f9ef429b624f3d20f8ba12acfbc8a15bb121c4036de4e5745932eff4 Error response from daemon: Start container error: Container is not running:004858d9f9ef429b624f3d20f8ba12acfbc8a15bb121c4036de4e5745932eff4 ``` @@ -520,9 +520,9 @@ isula run -ti --files-limit 1024 busybox bash 而docker会启动成功,其files.limit cgroup值为max。 ``` - [root@localhost ~]# docker run -itd --files-limit 1 rnd-dockerhub.huawei.com/official/busybox-aarch64 + $ docker run -itd --files-limit 1 rnd-dockerhub.huawei.com/official/busybox-aarch64 ef9694bf4d8e803a1c7de5c17f5d829db409e41a530a245edc2e5367708dbbab - [root@localhost ~]# docker exec -it ef96 cat /sys/fs/cgroup/files/files.limit + $ docker exec -it ef96 cat /sys/fs/cgroup/files/files.limit max ``` -- Gitee