<p>There was already a <a href="https://stackoverflow.com/questions/21200304/docker-how-to-show-the-diffs-between-2-images">stackoverflow question</a> about that topic, but the answers didn't really help me. The <a href="https://github.com/GoogleContainerTools/container-diff" rel="nofollow noreferrer">container-diff</a> tools was the most promising solution, but I would have preferred not relying on a third-party tool.</p>

<p>Finally, since docker can export an archive of a <em>container</em> filesystem, I end up with this solution:</p>

<pre><code>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
</code></pre>

<p>Then using your favorite diff tool you can examine the difference:</p>

<pre><code>vimdiff {base,target}.filelist
</code></pre>

CC BY-SA 4.0
2019-02-13T11:12:21.670Z
2019-02-13T11:12:21.670Z
Sylvain Leroux
<p>I asked a <a href="https://devops.stackexchange.com/q/6347/11179">similar question</a> a few minutes ago, and I found the <code>docker diff</code> command that shows the differences in the file system between a <em>container</em> and its <em>base image</em>. But I realized afterward my need is more complex than that.</p>

<p>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 <em>images</em>?</p>

<p>Here is an example:</p>

<pre><code>sh$ sudo docker image ls
REPOSITORY                    TAG                 IMAGE ID
rogueimage                    latest              77a21f689dcd
ubuntu                        18.04               47b19964fb50
</code></pre>

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

<docker><audit>
Listing filesystem differences between a Docker image and one of its ancestors
Sylvain Leroux
# Listing filesystem differences between a Docker image and one of its ancestors

(Asked by: username_0 on 2019-02-12)

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?

**Tags:** docker, audit


---

## 1 answers

### Answer by username_0 on 2019-02-13. Score: 0 | Accepted answer

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


---

