简体   繁体   English

docker-是否可以查看所有先前的Dockerfile?

[英]docker - Any way to view all preceding Dockerfiles?

For example: 例如:

  • python:3.6-stretch pulls from buildpack-deps:stretch python:3.6-stretch buildpack-deps:stretch中 拉出
  • which in turn pulls from buildpack-deps:stretch-scm 依次 buildpack-deps:stretch-scm中 拉出
  • which in turn... 反过来...

Thus I am wondering: is there a way to download/view all preceding Dockerfiles to understand what is coming from where and how? 因此,我想知道: 是否有一种方法可以下载/查看所有先前的Dockerfile,以了解来自何处以及来自何处?

Many thanks! 非常感谢!

docker history <IMAGE> will show you the history of an image. docker history <IMAGE>将显示docker history <IMAGE>的历史记录。 Some histories are better than others but you can get a sense of what is being done at each layer on the way. 有些历史要比其他历史要好,但是您可以了解在此过程中每一层所做的事情。 Size 0B usually means metadata added to the image while anything greater than 0B means ADD , COPY , RUN , or other file system related change. 大小0B通常表示添加到图像的元数据,而大于0B的任何值表示ADDCOPYRUN或其他与文件系统相关的更改。

if there an IMAGE ID then you can also do docker inspect <image id> which will tell you the details about the image . 如果有图像ID,那么您还可以通过docker inspect <image id>来告诉您有关image的详细信息。 If you just want to know the tag you can do 如果您只想知道标签,可以做

docker inspect --format='{{range .RepoTags}}{{.}}{{end}}' <image id>

A little example of formatting a history: 格式化历史记录的一个小例子:

docker history --format "{{.ID}}" <IMAGE> | grep -v "<missing>" | xargs docker inspect --format='{{range .RepoTags}}{{.}}{{end}} {{range .ContainerConfig.Cmd}}{{.}}{{end}}'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM