New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Proposal]: docker diff between image layers #12641
Comments
The most important thing would be how to "design" the command/arguments of the Should we do something like the # difference using images
# using tags
$ docker diff ubuntu 14.04..12.04
# using tags and ~
$ docker diff ubuntu 14.04..14.04~1
# using the latest tags
$ docker diff ubuntu 12.04 # same as latest..12.04
# difference between 2 layer using hashes
$ docker diff ubuntu 51a9c7c1f8bb..5f92234dcf1e This raise questions :
@tcurdt you might want to add a "Proposal :" on your title I guess :) |
@vdemeester true :) done! |
@vdemeester maybe we should look at it from the user stories. I would like to track fs changes across the different layers and see their impact on the image size. So a As for the interface I am wondering if it should maybe be a different command.
is on the container level. My proposal was for the image level.
or have it included in the The problem with
could work. |
To be honest, I would also like to see changes in json. |
#12919 is an effort in this direction. Produces a diff always with respect to the parent, for now.
|
@ashwinphatak Cool! The real interesting bit is the size of the change for me though. That seems to be not that easy to get though. I also think if we add a |
@tcurdt could you paste mock/sample output, as you envision it, for the proposed command? |
This is not the final proposal for the output - but just to show the general idea what I was after when I opened the feature request:
The final output should of course be more consistent. |
As the output is actually in a two layer hierarchy. |
thanks, I'll investigate options to get the size for each change. On Fri, May 1, 2015 at 2:21 PM, Torsten Curdt notifications@github.com
|
@ashwinphatak related to #12919 you might wanna follow the "Design Proposal" of the Advanced contributing page. |
@vdemeester sounds good. I might have jumped the gun a bit on the implementation. Let's discuss any related user stories first and then I'll write up a design proposal. |
+1 for this feature. Another study case: Something like this, maybe:
And maybe add recursive options. |
+1 for this. I was just trying to debug why the Postgres 9.5 test container was so large, and this feature would have helped. dieend's proposal for syntax and output seems fine to me. |
USER POLL The best way to get notified when there are changes in this discussion is by clicking the Subscribe button in the top right. The people listed below have appreciated your meaningfull discussion with a random +1: @doctapp |
Discussion seems to have died on this topic. I would hope that whatever proposal eventually moves forward will support diffing unrelated images. It seems like the immediate focus was on comparing different version of the same image, or perhaps layers within an image. Right now, this second, I would like the ability to compare images that should be identical but are not. one is the result of an automated built on dockerhub an the other is built locally. One works (runs to completion), the other does not. I'm going through right now comparing md5 checksums of every file in each image to find where they differ. It would be nice if there were a tool to help with this. |
I have the following requirements:
I plan to do like this:
Anyone have another ideas? Welcome more comments about this. Thanks. |
You can |
@thaJeztah I know what you mean. But I think "docker patch" has some advantages:
|
+1 @zhuguihua we should be able to:
img_B - img_A = patch_B to generate img_B, i just have to img_A + patch_B . storing patch_B would take so much less storage, transport time would be so small and less tax on network bandwidth. |
@zhuguihua @pavan123k While patching may seem like an obvious feature, docker images don't lend themselves well in a patch model with the current way they are represented. It might be good to divide this issue into two parts.
Use case 1 above is a much simpler undertaking and I'd hate to hold it up because of the complexity of adding |
I would be very interested to see changes. Doesn't need to be a full diff, but even just a list of touched filenames would be very helpful. For me, the main goal is to reduce image size, so being able to see what exactly contributes to the layer would be a great help. |
We have a slightly different use case for this functionality: tracking expectations when overriding vendor supplied files. The idea is when you do something like
|
+1 |
Still interested in this. My use case is that with a lot of automation around creating the image - one layer keeps changing and not leveraging the cache when there is no expected change. Investigating why a simple |
It seems as though several features are being conflated here, which is hindering reaching consensus. To increase chances of success, I propose limiting scope to a feature that just allows viewing what files each layer adds/modifies/deletes. ie: the equivalent of what would have been output by This means for now punting on:
I see the new output being surfaced by one or both of:
Image optimisation use-cases this would facilitate:
Some questions:
Many thanks :-) |
This is a nice way to list the changed files in a layer:
This was tested on the |
@vlk-charles Thanks. In case somebody else than me starts to wonder what is 'overlay2' check your storage driver using:
Mine said that it was using aufs (and naturally inspect-snippet above does not work with that). I had to create on my Ubuntu 16.04 (Docker version 17.05.0-ce, build 89658be) a file /etc/docker/daemon.json like mentioned in https://docs.docker.com/engine/userguide/storagedriver/selectadriver/#check-and-set-your-current-storage-driver .
If you used 'aufs' before also, do not be scared where your previous images and containers disappeared. |
FYI Got sent these links today, tools that might be of use to people subscribing to this issue: https://github.com/wagoodman/dive
https://github.com/orisano/dlayer
|
In case you're not using overlay2 but e.g. btrfs, this can get you a list of added files: docker save $IMAGE | tar xfO - $(docker save $IMAGE | tar xfO - manifest.json | jq -r '.[]|.Layers|.[-1]') | tar tv bit ugly. :/ Maybe there's a slightly easier way, for this kind of one-off solution? |
If you reached here because you want to compact very similar docker images for which the build process cannot make use of layer caching, you can check da-x/deltaimage: a tool to generate and apply binary deltas between Docker images to optimize registry storage. |
As discussed on IRC it would be great to be able to diff two images to see the changes on the file system level. The pragmatic approach would be to integrate it into the history command.
The text was updated successfully, but these errors were encountered: