49 lines
2.6 KiB
Plaintext
49 lines
2.6 KiB
Plaintext
1、查看docker镜像
|
||
docker images
|
||
2、进入docker镜像
|
||
docker run -it auto-rf-library:1.0 /bin/bash
|
||
docker run --name autotest.open.node.com --add-host=open.node.com:192.168.100.5 -it auto-rf-library:2.0
|
||
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
|
||
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:3.0 robot -d newreport/ tsg_autotest0416
|
||
|
||
执行不添加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
|
||
|
||
|
||
更新自定义库生成新镜像:
|
||
1、进入镜像
|
||
docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:2.0
|
||
2、复制自定义库到python目录
|
||
cp -r tsg_autotest0416/04-CustomLibrary/Custometest /usr/local/lib/python3.6/site-packages/
|
||
cp -r tsg_autotest0416/04-CustomLibrary/Smtp3Library /usr/local/lib/python3.6/site-packages/
|
||
3、提交新镜像f827为第一步进入镜像是的id
|
||
--------例如:[root@sugon1 ~]# docker run -it -v /home/autoTest_tsg/:/usr/src/python -w /usr/src/python auto-rf-library:2.0
|
||
----------root@b053a29b9b64:/usr/src/python# ls
|
||
|
||
docker commit f827 auto-rf-library:3.0
|