Listing filesystem differences between a Docker image and one of its ancestors 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?
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 &gt; base.filelist
sudo docker export "${TARGET_CID}" | tar tv &gt; target.filelist


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

vimdiff {base,target}.filelist