如何查看 Docker 容器创建时的参数/命令

发布时间: 更新时间: 总字数:194 阅读时间:1m 作者: IP属地: 分享 复制网址

没有使用 docker-compose 命令创建的容器(推荐),可以使用 runlikerekcod打印容器创建时的参数

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.

示例

  • 启动 nginx 容器
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;'
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数