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.
Have a look at :
https://github.com/GoogleCloudPlatform/container-diff
This tool can diff local or remote docker images and can do so without requiring docker to be installed. It has file as well as package level "differs" (for example: apt, npm, and pip) so that you can more easily see the differences in packages that have changed between two docker images.
Disclaimer: I am a contributor to this project
If you know container ID or name (even stopped container), you can quickly dump file list on-the-fly.
Then you can save list to file and compare too list files.
If you insist to use image ID or name, you can dump first layer's file list on-the-fly:
After all, i suggest you start the container then stop it, then you can get a merged file list as described in first way.
2017/02/01: The fastest way to show container's file list, you are free to enter its root dir to read files:
Note, if you are using docker-machine, you need first enter it by
docker-machine ssh
thensudo sh
.Now you get the root dir of the two container, you can use diff to compare them directly.
I suppose you could send both images' file systems to tarballs via
docker export CONTAINER_ID
ordocker save IMAGE_ID
(updated based on comments)Then use whatever tool you like to diff the file systems - Git, Rdiff, etc.
Each RUN instruction creates a new container and you can inspect what a container changed by using
docker diff <container>
.So after building your dockerfile, run
docker ps -a
to get a list of the containers the buildfile created. It should look something like:Now you can do do
docker diff 53d7dadafee7
to see what was changed.Have a look at:
https://github.com/moul/docker-diff
They list
Brew
install instructions for Mac, I'm assuming it's a Bash script, so I assume it could be made to work in other *nix environments.This one worked for me:
Where e5cba87ecd29 and b1d19fe1a941 are images I am interested in and /path/to/files is a directory which could be "/". It lists all files, sorts it and add hash to it just in case. And meld highlights all the differences.