GoogleContainerTools / container-diff

container-diff: Diff your Docker containers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

layer diff depends on layer ordering

aaron-prindle opened this issue · comments

currently when diffing layers of images, container-diff essentially requires layers to in the same order and have the same number of layers for the diff to be meaningful. A single missing layer early will cause the layer introspection to compare "the wrong" layers. it would be awesome if container-diff could try to correlate the layers but it is understandable if this is outside the scope of container-diff

I agree this would be great, but I'm not totally sure what it would look like. Layer comparison is hard because we don't really have a good way of "correlating" layers. SHAs don't work because adding a single file to a layer gives it an entirely new SHA. We could try and do something clever with sizes (for each layer, find the layer closest in size and compare those two), but there are corner cases where that would break down and give us garbage results. Any suggestions for a better way to go about this are certainly welcome :)

just an idea, but probably something similar to what was suggested in #233 (review) would do the trick. Instead of trying to guess the layers to compare, let user select them by introducing somehow the layer IDs to compare.

I think that's a fine idea actually, as discussed in #248 it's probably the only option for comparing images with a variable number of layers. Are you interested in sending a PR?

@nkubala I can try to make a PR for that, probably it will take me some days to find the spare cycles to do it, but I'll try to come up with a suggestion.