docker runlike获取容器创建时的命令

docker runlike获取容器创建时的命令

1.1 安装Python-pip

yum -y install python-pip   //linux
apt -y install python-pip    //ubuntu

2.1 安装runlike

pip install runlike

我在linux安装时报错:

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-jWgv5b/click/
You are using pip version 8.1.2, however version 22.1.2 is available
You should consider upgrading via the 'pip install --upgrade pip' command

解决方法:先看自己本地python版本,选择下面对应版本升级pip

# 升级pip:
1.sudo wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
2.sudo python get-pip.py
3.pip -V

# 升级pip3:
1.sudo wget https://bootstrap.pypa.io/pip/3.5/get-pip.py
2.sudo python3 get-pip.py
3.pip -V

没有问题后再安装runlike

pip install runlike

3.1 使用runlike

runlike -p 容器
[15:51:20][root@yuanian-61-186:~]# runlike -p nginx
docker run \
	--name=nginx \
	--hostname=328f219d6fd2 \
	--mac-address=02:42:ac:11:00:02 \
	--env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
	--env=NGINX_VERSION=1.17.0 \
	--env=NJS_VERSION=0.3.2 \
	--env='PKG_RELEASE=1~stretch' \
	--volume=/data/deploy/nginx/data:/usr/share/nginx/html \
	--volume=/data/deploy/nginx/conf:/etc/nginx \
	-p 8080:8080 \
	-p 443:443 \
	--expose=80 \
	--restart=unless-stopped \
	--label='maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>' \
	--log-opt max-size=5m \
	--detach=true \
	192.168.48.90/common/nginx:1.17.0 \
	nginx -g 'daemon off;'
posted @ 2022-07-11 15:52  liwenchao1995  阅读(382)  评论(0编辑  收藏  举报