docker:如何显示2张图像之间的差异 [英] docker: how to show the diffs between 2 images

查看:135
本文介绍了docker:如何显示2张图像之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Docker文件,其中包含执行apt-get install的RUN指令序列;例如,几行:

 运行apt-get install -y树
运行apt-get install - y git

执行docker build后,如果我执行docker images -a我看到在构建过程中创建的所有基本孩子的图像列表。



我想看到所有的当apt-get install -y git行被执行时(包括除了git软件包之外还可能安装的依赖软件包)安装的软件包。



注意:我相信docker diff命令显示容器和从其开始的映像之间的差异。相反,我想要两个图像(相同的谱系)之间的差异:树和git图像ID。这是可能的吗?



谢谢。

解决方案

通过 docker export CONTAINERID 或docker保存IMAGEID(根据注释更新)将两个图像的文件系统发送到tarball



然后使用您喜欢的任何工具来区分文件系统 - Git,Rdiff等。


I have a Dockerfile with a sequence of RUN instructions that execute "apt-get install"s; for example, a couple of lines:

RUN apt-get install -y tree
RUN apt-get install -y git

After having executed "docker build", if I then execute "docker images -a", I see the listing of all the base-child-child-.... images that were created during the build.

I'd like to see a list of all of the packages that were installed when the "apt-get install -y git" line was executed (including the dependent packages that may have also been installed, besides the git packages).

Note: I believe that the "docker diff" command shows the diffs between a container and the image from which it was started. Instead I'd like the diffs between 2 images (of the same lineage): the "tree" and "git" image IDs. Is this possible?

Thanks.

解决方案

I suppose you could send both images' file systems to tarballs via docker export CONTAINERID or docker save IMAGEID (updated based on comments)

Then use whatever tool you like to diff the file systems - Git, Rdiff, etc.

这篇关于docker:如何显示2张图像之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆