wagoodman / dive

A tool for exploring each layer in a docker image
MIT License
46.66k stars 1.77k forks source link

Is it possible to view the aggregate difference between specific layers? #414

Open Asday opened 2 years ago

Asday commented 2 years ago

Suppose I have a Dockerfile with many layers, then the following

RUN apk add --virtual .build-deps some package names
RUN pip install some python package names
RUN apk del .build-deps

Then perhaps some more layers. Is there a way in dive to see the aggregate changes from the start of those three layers to the end, such that I can see what to COPY in a multi-stage build? As far as I can tell, I can only see the diff from the start to the end of a single layer, or from the start of the most base docker image(?) to the end of the current layer, which has a great deal of noise.

Note that I could change the Dockerfile to read something like

RUN apk add --virtual .build-deps some package names \
  && pip install some python package names \
  && apk del .build-deps

But that involves installing the build requirements every time the python package requirements change, rather than simply reusing a previous layer. (I'm also aware of buildkit's cache mounts and --no-cache for apk, but they're not relevant enough to the question to muddy the examples).

mark2185 commented 2 years ago

Just to clarify, you'd like to view aggregate changes from an arbitrary start layer, to an arbitrary end layer, instead of seeing the diff from the beginning to the current layer?

If so, that's currently not possible.

Asday commented 2 years ago

You've understood me perfectly, and also saddened me. Thank you.

In that case I'll leave this issue open as a feature request.

mark2185 commented 2 years ago

Don't hold your breath, though, the project isn't too active, unfortunately. Last significant changes were made back in 2020.

If you do decide to take matters into your own hands, please base it on top of #399 since it contains some much needed fixes already.