- 使用python三方库进行 需要安装python解释器
安装runlike安装包
pip3 install runlike
运行命令
runlike -p <container_name> # 后面可以是容器名和容器id,-p参数是显示自动换行
实验
- 使用docker启动一个jenkins
启动命令为
docker run -d \
-p 9002:8080 \
-p 50000:50000 \
-v /usr/local/jenkins:/var/jenkins_home \
-v /etc/localtime:/etc/localtime \
-v /usr/bin/docker:/usr/bin/docker \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /python_project/zhaotong:/var/zhaotong \
-v /usr/local/python3.9:/var/python3.9/bin \
-v /python_project/everyday_check:/var/everyday_check \
-v /usr/local/jenkins/workspace/everyday_check/allure-result:/var/everyday_check/report/temp_jsonreport \
-v /usr/bin:/var/bin \
-v /lib64/:/var/lib64 \
-u root \
--restart=always \
--name=jenkins \
jenkins/jenkins
使用 runlike - p 容器id号为
docker run --name=jenkins \--hostname=0da4efaead25 \--user=root \--mac-address=02:42:ac:11:00:02 \--volume=/var/run/docker.sock:/var/run/docker.sock \--volume=/usr/local/jenkins/workspace/everyday_check/allure-result:/var/everyday_check/report/temp_jsonreport \--volume=/usr/bin:/var/bin \--volume=/usr/local/jenkins:/var/jenkins_home \--volume=/usr/bin/docker:/usr/bin/docker \--volume=/usr/local/python3.9:/var/python3.9/bin \--volume=/python_project/everyday_check:/var/everyday_check \--volume=/lib64/:/var/lib64 \--volume=/etc/localtime:/etc/localtime \--volume=/python_project/zhaotong:/var/zhaotong \--network=bridge \-p 50000:50000 \-p 9002:8080 \--restart=always \--runtime=runc \--detach=true \jenkins/jenkins
结论: 是可信的,只是-v
写成了--volume=
等差别