如何查看码头图像的树视图? [英] How to see tree view of docker images?
问题描述
我知道docker已经从 docker images
命令中废止了 - tree
标志。但是我找不到任何方便的命令来获得相同的输出,如 docker images --tree
。我发现
I know docker has deprecated --tree
flag from docker images
command. But I could not find any handy command to get same output like docker images --tree
. I found dockviz. But it seems to be another container to run. Is there any built in cli command to see tree view of images without using dockviz
The current (Sept 2015, docker 1.8) workaround mentioned by issue 5001 remains dockviz
indeed:
docker run --rm -v /var/run/docker.sock:/var/run/docker.sock nate/dockviz images -t
The -t
allows to remain in CLI only (no graphics needed)
Update Sept. 2016 (post docker 1.10: docker 1.11 soon 1.12), one year later, as mentioned in the same issue 5001, by Michael Härtl:
Since 1.10 the way layer IDs worked has changed fundamentally. For a lengthy explanation of this topic see #20399. There's also #20451 but I'm not sure, if this could be used by the nate/dockviz image.
Personally I find the way the new layers work very very confusing and much less transparent than before. And it's not really well documented either.
AFAIK @tonistiigi's comments in the issue above are the only public explanation available.
Pre v1.10 there was no concept of layers or the other way to think about it is that every image only had one layer. You built a chain of images and you pushed and pulled a chain. All these images in the chain had their own config.
Now there is a concept of a layer that is a content addressable filesystem diff. Every image configuration has an array of layer references that make up the root filesystem of the image and no image requires anything from its parent to run. Push and pull only move a single image, the parent images are only generated for a local build to use for the cache.
If you build an image with the Dockerfile, every command adds a history item into the image configuration. This stores to command so you can see it in docker history. As this is part of image configuration it also moves with push/pull and is included in the checksum verification.
Here are some examples of content addressable configs:
https://gist.github.com/tonistiigi/6447977af6a5c38bbed8Terms in v1.10: (the terms really have not changed in implementation but previously our docs probably simplified things).
- Layer is a filesystem diff. Bunch of files that when stacked on top of each other make up a root filesystem. Layers are managed by graphdrivers, they don't know anything about images.
- Image is something you can run and that shows up in docker images -a. Needs to have a configuration object. When container starts it needs some kind of way to generate a root filesystem from image info. On build every Dockerfile command creates a new image.
You can refer to the more recent project TomasTomecek/sen
, which:
- had to understand 1.10 new layer format (commit 82b224e)
- include an image tree representation:
这篇关于如何查看码头图像的树视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!