镜像反向生成Dockerfile(history) 原创 Docker容器 2022年11月17日 21:19 夏至未至 928 当前内容 1049 字,在路上,马上到,马上到 ### 目录 [TOC] ### 查看镜像 [root@master mysql]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE hello-world latest feb5d9fea6a5 13 months ago 13.3kB [root@master mysql]# ### 反向查看 #### 反向命令 docker history hello-world:latest --no-trunc=true #### 反向效果 [root@master mysql]# docker history hello-world:latest --no-trunc=true IMAGE CREATED CREATED BY SIZE COMMENT sha256:feb5d9fea6a5e960.... 13 months ago /bin/sh -c #(nop) CMD ["/hello"] 0B 13 months ago /bin/sh -c #(nop) COPY file:50563a97010fd7ce1ceebd1f... in / 13.3kB [root@master mysql]# #### 反向解释 docker history是docker自带的命令工具,一般情况下它可以满足我们查看构建过程的需求,但是有一些不足,它的整个展示的结果是逆序的和我们的Dockerfile是相反的,这意味着我们需要从下往上看。 上述反向的意思就是,拷贝一个脚本文件 hello 进来,然后执行脚本。 ### 其他反向工具介绍 alpine/dfimage工具 dive工具 这里只提供本人使用过的工具名,有兴趣可以研究下,一般情况下,history 能满足需求。 本文标题: 镜像反向生成Dockerfile(history) 本文作者: 夏至未至 发布时间: 2022年11月17日 21:19 最近更新: 2022年11月17日 21:23 原文链接: 许可协议: 署名-非商业性-禁止演绎 4.0 国际(CC BY-NC-ND 4.0) 请按协议转载并保留原文链接及作者 Docker(8) 上一个 Cannot download repodata/repomd.xml(更换yum源) 下一个 Docker-compose 安装(亲测有效) 当前文章评论暂未开放,请移步至留言处留言。