This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
dongxiaoyan-tsg-autotest/05-Other/docker.txt

33 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-04-07 12:51:52 +08:00
1、查看docker镜像
docker images
2、进入docker镜像
docker run -it auto-rf-library:1.0 /bin/bash
3、执行自动化项目
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-lib:latest[docker最新镜像] -d /newrepot/ robot tsg_autotest0406[project path]
执行添加hosts文件使用自建服务器作为网页访问
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d newreport/ tsg_autotest0406
执行不添加hosts文件
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -d /newrepot/ tsg_autotest0406
docker start containerid
4、单独镜像根据此目录下id但是每次执行时不同的镜像id修复此文件不太实用。修改hosts
cd /var/lib/docker/containers/
5、解决办法使用cmd命令删除这些文件我写了一个批处理文件第一句是切换到临时文件的目录第二句是循环将名称未scoped_dir开头的文件夹都删掉
cd /d C:\Users\A127\AppData\Local\Temp
for /f %%i in ('dir /ad /b scoped_dir*') do (rd /s /q %%i)
1
2
然后在robotframework中使用OperatingSystem中的run命令运行这个批处理文件如下所示
Run Keyword And Ignore Error OperatingSystem.run cleartmp.bat
5、删除所有已经退出容器
docker rm $(docker ps -a -q)
docker run --add-host=open.node.com:192.168.100.5 -it auto-rf-library:1.0
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:1.0 robot -i tsg_adc -d newreport/ tsg_autotest0406