1.使用带格式化的inspect命令

docker inspect \
  --format "$(curl -s https://gist.githubusercontent.com/efrecon/8ce9c75d518b6eb863f667442d7bc679/raw/run.tpl)" \
  <容器名>|<容器ID>

2.使用docker run命令

docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro \
    assaflavie/runlike <容器名>|<容器ID>

或者

alias runlike="docker run --rm -v /var/run/docker.sock:/var/run/docker.sock:ro assaflavie/runlike"

runlike <容器名>|<容器ID>

3.安装runlike软件

sudo apt install python-pip
sudo pip install runlike
runlike -p <容器名>|<容器ID>

在这里插入图片描述

参考

https://stackoverflow.com/questions/32758793/how-to-show-the-run-command-of-a-docker-container#

https://blog.csdn.net/qq_33355821/article/details/110201460

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐