跳到主要内容

查看容器的启动命令

安装

#安装runlike
pip3 install runlike

检查

#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
-s, --stdin
--help Show this message and exit.

使用

命令格式:

runlike -p [容器名称]/[容器ID]

示例:

#docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
304f6cfa0e2e registry "/entrypoint.sh /etc…" 3 weeks ago Up 10 minutes 0.0.0.0:5000->5000/tcp, :::5000->5000/tcp registry

#runlike -p registry
docker run \
--name=registry \
--hostname=304f6cfa0e2e \
--mac-address=02:42:ac:11:00:02 \
--env=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
--volume=/soft/docker/repository:/var/lib/registry \
--volume=/var/lib/registry \
--privileged \
-p 5000:5000 \
--restart=always \
--runtime=runc \
--detach=true \
registry \
/etc/docker/registry/config.yml