0

I asked a similar question a few minutes ago, and I found the docker diff command that shows the differences in the file system between a container and its base image. But I realized afterward my need is more complex than that.

I have a Docker image, and I know that Docker image was build from a given base image. Is there a way to list the filesystem changes between those two images?

Here is an example:

sh$ sudo docker image ls
REPOSITORY                    TAG                 IMAGE ID
rogueimage                    latest              77a21f689dcd
ubuntu                        18.04               47b19964fb50

I know rogueimage:latest is based on ubuntu:18.04 but I would like to know the filesystem difference between the two images. How to do that?

0

There was already a stackoverflow question about that topic, but the answers didn't really help me. The container-diff tools was the most promising solution, but I would have preferred not relying on a third-party tool.

Finally, since docker can export an archive of a container filesystem, I end up with this solution:

BASE_CID=$(sudo docker create ubuntu:18.04)
TARGET_CID=$(sudo docker create rogueimage:latest)

sudo docker export "${BASE_CID}" | tar tv > base.filelist
sudo docker export "${TARGET_CID}" | tar tv > target.filelist

Then using your favorite diff tool you can examine the difference:

vimdiff {base,target}.filelist

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.