openeuler-riscv / oerv-team

OERV 实习生工作中心
11 stars 43 forks source link

docker功能测试 #1514

Open jiewu9823 opened 1 week ago

jiewu9823 commented 1 week ago

需求:

  1. oerv 24.03 LTS 版本镜像 中测试该镜像的 docker 功能
  2. 测试项目参考 https://docs.qq.com/sheet/DSk1ERG1qcnJTdmFJ?tab=BB08J2

要求:

  1. 测试完成后将测试结果填写在 https://docs.qq.com/sheet/DSk1ERG1qcnJTdmFJ?tab=BB08J2
  2. ddl 2024/11/20
Ywinh commented 2 days ago

测试文档

docker安装

[root@bogon ~]# dnf install docker
[root@bogon ~]# docker --version
Docker version 18.09.0, build 33f6ee3
[root@bogon ~]# uname -a
Linux bogon 6.6.0-27.0.0.31.oe2403.riscv64 #1 SMP Fri May 24 21:52:58 CST 2024 riscv64 riscv64 riscv64 GNU/Linux

[root@bogon ~]# systemctl status docker
● docker.service - Docker Application Container Engine
     Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; preset: d>
     Active: active (running) since Sat 2024-04-20 14:31:28 UTC; 8min ago
       Docs: https://docs.docker.com
   Main PID: 7340 (dockerd)
      Tasks: 22 (limit: 48486)
     Memory: 39.2M ()
     CGroup: /system.slice/docker.service
             ├─7340 /usr/bin/dockerd --live-restore
             └─7348 containerd --config /var/run/docker/containerd/containerd.t>

Apr 20 14:31:25 bogon dockerd[7340]: time="2024-04-20T14:31:25.602967100Z" leve>
Apr 20 14:31:26 bogon dockerd[7340]: time="2024-04-20T14:31:26.364849700Z" leve>
Apr 20 14:31:26 bogon dockerd[7340]: time="2024-04-20T14:31:26.418919800Z" leve>
Apr 20 14:31:26 bogon dockerd[7340]: time="2024-04-20T14:31:26.979006700Z" leve>
Apr 20 14:31:27 bogon dockerd[7340]: time="2024-04-20T14:31:27.298336900Z" leve>
Apr 20 14:31:28 bogon dockerd[7340]: time="2024-04-20T14:31:28.148181900Z" leve>
Apr 20 14:31:28 bogon dockerd[7340]: time="2024-04-20T14:31:28.151397400Z" leve>
Apr 20 14:31:28 bogon dockerd[7340]: time="2024-04-20T14:31:28.275364400Z" leve>
Apr 20 14:31:28 bogon dockerd[7340]: time="2024-04-20T14:31:28.375041900Z" leve>
Apr 20 14:31:28 bogon systemd[1]: Started Docker Application Container Engine.

docker启动容器

一般容器启动正常

portainer:似乎架构不兼容无法运行?docker logs查看

writing syncT "procError": write pipe: file already closed
libcontainer: container start initialization failed: exec /portainer: exec format errorlibcontainer: container init failed to exec

docker基本功能

支持新建docker网络

[root@localhost ~]# docker network create test-network
bca7f290f928902f893845de0e3ec6797da9c6d95fc70bb9a179c82b9f58540f
[root@localhost ~]# docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
e38e3d0dd143        bridge              bridge              local
42e1c85838f0        host                host                local
5b50b89e24be        none                null                local
bca7f290f928        test-network        bridge              local
[root@localhost ~]# docker run -itd --rm --name busybox1 --net=test-network m.daocloud.io/docker.io/library/busybox:latest sh
dc3c4d774719c8f46b52deee2b333f85b165ceafb9729c1c5c5b1de74e51f643
[root@localhost ~]# docker run -itd --rm --name busybox2 --net=test-network m.daocloud.io/docker.io/library/busybox:latest sh
72d0b34de06b0dd4285
[root@localhost ~]# docker exec busybox1 ping -c 3 172.18.0.3
PING 172.18.0.3 (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: seq=0 ttl=64 time=8.219 ms
64 bytes from 172.18.0.3: seq=1 ttl=64 time=1.205 ms
64 bytes from 172.18.0.3: seq=2 ttl=64 time=1.042 ms

--- 172.18.0.3 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.042/3.488/8.219 ms
[root@localhost ~]# docker exec busybox1 ping -c 3 busybox2
PING busybox2 (172.18.0.3): 56 data bytes
64 bytes from 172.18.0.3: seq=0 ttl=64 time=1.514 ms
64 bytes from 172.18.0.3: seq=1 ttl=64 time=1.019 ms
64 bytes from 172.18.0.3: seq=2 ttl=64 time=0.947 ms

--- busybox2 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.947/1.160/1.514 ms

新建网络,新建两个容器在同一网络,可以ping通

备份镜像

[root@localhost ~]# docker images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED                  SIZE
m.daocloud.io/docker.io/library/busybox                          latest              f9d36075878c        Less than a second ago   1.47MB
[root@localhost ~]# docker save -o busybox_backup.tar m.daocloud.io/docker.io/library/busybox:latest
[root@localhost ~]# ls -lh
total 1.7M
-rw------- 1 root root 1.7M Apr 20 15:33 busybox_backup.tar

删除镜像

[root@localhost ~]# docker rmi m.daocloud.io/docker.io/library/busybox:latest
Untagged: m.daocloud.io/docker.io/library/busybox:latest
Untagged: m.daocloud.io/docker.io/library/busybox@sha256:768e5c6f5cb6db0794eec98dc7a967f40631746c32232b78a3105fb946f3ab83
Deleted: sha256:f9d36075878c4a6324dbc398b4fa16b4e40fc082bb9b76ca62f32d4c92b2ece0
Deleted: sha256:f0793547d897b99d513ac69377af04762541007f596ae6ed433b803886e8b7d8
[root@localhost ~]# docker images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED                  SIZE
registry.cn-hangzhou.aliyuncs.com/tylerzhong/gulimall-nginx      v1.2                b0dc20efcbf8        Less than a second ago   183MB
hello-world                                                      latest              ef56fe44c1ae        11 months ago            4.98kB
registry.cn-shenzhen.aliyuncs.com/liyang_main/java_environment   nginx-1.24.0        6c0218f16876        12 months ago            142MB
registry.cn-shenzhen.aliyuncs.com/liyang_main/java_environment   portainer           5f11582196a4        17 months ago            287MB

导入镜像

[root@localhost ~]# docker load -i busybox_backup.tar
f0793547d897: Loading layer    1.7MB/1.7MB
Loaded image: m.daocloud.io/docker.io/library/busybox:latest
[root@localhost ~]# docker images
REPOSITORY                                                       TAG                 IMAGE ID            CREATED                  SIZE
m.daocloud.io/docker.io/library/busybox                          latest              f9d36075878c        Less than a second ago   1.47MB
registry.cn-hangzhou.aliyuncs.com/tylerzhong/gulimall-nginx      v1.2                b0dc20efcbf8        Less than a second ago   183MB
hello-world                                                      latest              ef56fe44c1ae        11 months ago            4.98kB
registry.cn-shenzhen.aliyuncs.com/liyang_main/java_environment   nginx-1.24.0        6c0218f16876        12 months ago            142MB
registry.cn-shenzhen.aliyuncs.com/liyang_main/java_environment   portainer           5f11582196a4        17 months ago            287MB

卷映射:busybox为例

[root@bogon ~]# echo "Hello from Host" > tmp/test-volume/hostfile.txt 
[root@bogon ~]# docker run --rm -it -v /root/tmp/test-volume/hostfile.txt:/data  f9d36075878c 
——————————---以下进入docker容器
/ # ls -ll
total 40
drwxr-xr-x    2 root     root         12288 Sep 26  2024 bin
-rw-r--r--    1 root     root            16 Apr 20 14:49 data
drwxr-xr-x    5 root     root           360 Apr 20 14:50 dev
drwxr-xr-x    1 root     root          4096 Apr 20 14:50 etc
drwxr-xr-x    2 nobody   nobody        4096 Sep 26  2024 home
dr-xr-xr-x  172 root     root             0 Apr 20 14:50 proc
drwx------    1 root     root          4096 Apr 20 14:50 root
dr-xr-xr-x   12 root     root             0 Apr 20 14:50 sys
drwxrwxrwt    2 root     root          4096 Sep 26  2024 tmp
drwxr-xr-x    4 root     root          4096 Sep 26  2024 usr
drwxr-xr-x    4 root     root          4096 Sep 26  2024 var
/ # cat data
Hello from Host
/ # echo "Hello from Container" >> data
/ # exit
[root@bogon ~]# cat tmp/test-volume/hostfile.txt 
Hello from Host
Hello from Container

docker稳定性

支持宿主机和docker容器同时压力测试