Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker功能测试 #1514

Open
jiewu9823 opened this issue Nov 12, 2024 · 1 comment
Open

docker功能测试 #1514

jiewu9823 opened this issue Nov 12, 2024 · 1 comment
Assignees
Labels

Comments

@jiewu9823
Copy link
Collaborator

需求:

  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
Copy link
Contributor

Ywinh commented Nov 23, 2024

#测试文档

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容器同时压力测试

  • docker镜像为ubuntu:latest

  • ltp测试集在宿主机上通过git源码编译,安装到/opt/ltp目录下,详见https://linux-test-project.readthedocs.io/en/latest/users/quick_start.html

  • 通过docker cp传入ubuntu镜像

  • #!/bin/bash
    
    cd /opt/ltp && ./runltp mm &
    docker exec  -w /opt/ltp ubuntu01 ./runltp mm &
    
  • -----------宿主机log----------
    [root@bogon results]# cat LTP_RUN_ON-2024_11_20-21h_42m_58s.log 
    Test Start Time: Wed Nov 20 21:43:03 2024
    -----------------------------------------
    Testcase                                           Result     Exit Value
    --------                                           ------     ----------
    abort01                                            PASS       0    
    accept01                                           PASS       0    
    accept02                                           PASS       0    
    accept03                                           PASS       0    
    accept4_01                                         PASS       0    
    access01                                           PASS       0    
    access02                                           PASS       0    
    access03                                           PASS       0    
    access04                                           PASS       0    
    acct01                                             PASS       0    
    acct02                                             PASS       0    
    add_key01                                          PASS       0    
    add_key02                                          PASS       0    
    add_key03                                          PASS       0    
    add_key04                                          PASS       0     
    ....
    
  • ——————————————————docker log----------------
    root@89fa636ed3a4:/opt/ltp/results# cat LTP_RUN_ON-2024_11_20-21h_43m_01s.log 
    Test Start Time: Wed Nov 20 21:43:04 2024
    -----------------------------------------
    Testcase                                           Result     Exit Value
    --------                                           ------     ----------
    abort01                                            PASS       0    
    accept01                                           PASS       0    
    accept02                                           PASS       0    
    accept03                                           PASS       0    
    accept4_01                                         PASS       0    
    access01                                           PASS       0    
    access02                                           PASS       0    
    access03                                           PASS       0    
    access04                                           PASS       0    
    acct01                                             PASS       0    
    acct02                                             PASS       0    
    add_key01                                          PASS       0    
    add_key02                                          PASS       0  
    ....
    

支持同时运行多个容器

写了一个脚本:启动50个容器

[root@bogon ~]# cat container.sh 
#!/bin/bash
for NUM in {1..50}
do
            # 启动每个容器,命名为 ubuntu1, ubuntu2, ..., ubuntu50
                 docker run -itd --name "ubuntu$NUM" cbcb3fc5458e /bin/bash
done


[root@bogon ~]# docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
24be81663542        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu50
f9d4ef9ba6a0        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu49
974af9dbebbe        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu48
6f07ca1b5fc7        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu47
b2a79fcb9dcc        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu46
c3ef2d06d3af        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu45
f9fa94358b18        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu44
d0d815879c66        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu43
6dd385b376c6        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu42
91ae0eb18c8d        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu41
eeaf8741ff25        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu40
d6766346eaca        cbcb3fc5458e        "/bin/bash"         2 minutes ago       Up 2 minutes                            ubuntu39
23351df94a64        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 2 minutes                            ubuntu38
80c190f00d15        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu37
662fa487fc31        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu36
324ad5e6b65c        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu35
5d94e1ab9bf3        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu34
430c2cb08c07        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu33
b8a9b5a758dd        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu32
918281d1b747        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu31
763482e48179        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu30
b3e0502062bc        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu29
a9719a65bbb2        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu28
28bf67873d38        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu27
d771ddb220e3        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu26
b98ff4d33eb9        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu25
c574a2fe1719        cbcb3fc5458e        "/bin/bash"         3 minutes ago       Up 3 minutes                            ubuntu24
7cd2245c503b        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 3 minutes                            ubuntu23
29481db09057        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu22
21e7acc83234        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu21
f6755f320b9c        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu20
24624297b1a1        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu19
7346b3e6123a        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu18
dab1cdf31fac        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu17
6db70e2b0789        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu16
0742a6eb706f        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu15
ce2684752bc8        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu14
c9295d96334e        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu13
b68abc58fce2        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu12
b6ff32dce3b7        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu11
d389c31ba6a5        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu10
ba819fee3992        cbcb3fc5458e        "/bin/bash"         4 minutes ago       Up 4 minutes                            ubuntu9
ed8145fea30d        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 4 minutes                            ubuntu8
5ecc43f4b725        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu7
0bb8735b29fb        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu6
4428cb59f9da        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu5
7a5b884eefe9        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu4
a9aff2b6b77c        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu3
4fc5ea44067e        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu2
6808e314c86a        cbcb3fc5458e        "/bin/bash"         5 minutes ago       Up 5 minutes                            ubuntu1
e9950b1f0082        f9d36075878c        "sh"                21 minutes ago      Up 21 minutes                           jovial_pare
a497ce4d0df7        9cabf3915af1        "/bin/bash"         22 minutes ago      Up 22 minutes                           blissful_euclid
457f6c13852f        cbcb3fc5458e        "/bin/bash"         22 minutes ago      Up 22 minutes                           amazing_lewin
92523b063bab        ed13537c7919        "/bin/bash"         24 minutes ago      Up 24 minutes       8080/tcp            gifted_visvesvaraya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants