没有使用 docker-compose
命令创建的容器(推荐),可以使用 runlike
、rekcod
打印容器创建时的参数
runlike
安装
pip install runlike
Help
runlike --help
Usage: runlike [OPTIONS] CONTAINER
Shows command line necessary to run copy of existing Docker container.
Options:
--no-name Do not include container name in output
-p, --pretty
--help Show this message and exit.
示例
docker run -it -d nginx
$ runlike -p 004 --no-name
docker run \
--hostname=004b3b4c779f \
--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.19.9 \
--env=NJS_VERSION=0.5.3 \
--env='PKG_RELEASE=1~buster' \
--expose=80 \
--restart=no \
--label='maintainer=NGINX Docker Maintainers <docker-maint@nginx.com>' \
--detach=true \
-t \
nginx \
nginx -g 'daemon off;'
rekcod
安装
yum install npm -y
npm i -g rekcod
示例
$ rekcod 004
docker run --name goofy_booth --runtime runc --restart no -h 004b3b4c779f --expose 80/tcp -l maintainer='NGINX Docker Maintainers <docker-maint@nginx.com>' -e 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' -e 'NGINX_VERSION=1.19.9' -e 'NJS_VERSION=0.5.3' -e 'PKG_RELEASE=1~buster' -d -t -i --entrypoint "/docker-entrypoint.sh" nginx 'nginx' '-g' 'daemon off;'