Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

[bug] hiting the cache even tough docker image has changed #332

@guilherme

Description

@guilherme

Expected behavior

  1. container-diff diff image-a image-b --type=file
  2. docker pull image-a or docker build . --tag image a
  3. container-diff diff image-a image-b --type=file

should produce different results.

Actual behavior

Currently, running the same sequence of steps don't produce different results (the cached version gets repeated) and it's not obvious for the end-user which specific versions of the images were compared.

Comment about implementation:
It seems that the docker image is based off the argument passed as image name alone, and no inspecting on the image is actually done.

One possible solution could be to use the image digest combined with the name for the cache key.

Information

  • container-diff version: v0.15.0
  • Operating system: OSX 10.15.4

Steps to reproduce the behavior

  1. Create image-a
FROM busybox

RUN echo "hi" > /hello

CMD ["cat", "/hello"]

Then

docker build -t image-a:latest -f Dockerfile.a .
  1. Create image-b
FROM busybox

RUN echo "ola" > /hello

CMD ["cat", "/hello"]

Then

docker build -t image-b:latest -f Dockerfile.b .
  1. Perform diff
container-diff diff daemon://image-a daemon://image-b --type=file

Output:

➜  container-diff-test container-diff diff daemon://image-a:latest daemon://image-b:latest --type=file 

-----File-----

These entries have been added to image-a:latest: None

These entries have been deleted from image-a:latest: None

These entries have been changed between image-a:latest and image-b:latest:
FILE          SIZE1        SIZE2
/hello        3B           4B
  1. Rebuild b
# change ola to 'hi' in Dockerfile.b and rebuild it with: 
docker build -t image-b:latest -f Dockerfile.b .
  1. Diff a and b again
➜  container-diff-test container-diff diff daemon://image-a:latest daemon://image-b:latest --type=file 

-----File-----

These entries have been added to image-a:latest: None

These entries have been deleted from image-a:latest: None

These entries have been changed between image-a:latest and image-b:latest:
FILE          SIZE1        SIZE2
/hello        3B           4B

I would expect the following output:

➜  container-diff-test container-diff diff daemon://image-a:latest daemon://image-b:latest --type=file 

-----File-----

These entries have been added to image-a:latest: None

These entries have been deleted from image-a:latest: None

These entries have been changed between image-a:latest and image-b:latest: None

( To get this I had to remove the cache file)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions