如何理解Docker构建过程给出的输出?

时间:2018-03-26 03:32:53

标签: docker dockerfile

我试图了解输出,以便我可以更好地调试。

我对这些看似随机生成的字母数字字符串的含义感到困惑。

例如:

Successfully built b344b7f40976
Successfully tagged registry.heroku.com/boiling-anchorage-81724/django:latest
=== Pushing django (/Users/sju/Dev/django/django-docker-1/luup/Dockerfile.django)
The push refers to a repository [registry.heroku.com/boiling-anchorage-81724/django]
e6e47ddb916a: Pushed 
c653a8994f81: Pushed 
f3f33e8a7200: Pushed 
3be97181d9ea: Pushed 
0494493cc4fc: Pushed 
72d642705832: Layer already exists 
14250e74103d: Pushed 
e355feaece70: Pushed 
eca7788e251f: Layer already exists 
694f3359e1fc: Pushed 
84e8dee479c4: Pushed 
3e0f5afa8e94: Pushed 
e20ab7df8200: Layer already exists 
b16afe30b3c2: Pushed 
43d1ca0c8750: Pushed 
6f7f56cd7b7f: Pushed 
ef2bc0294f0a: Layer already exists 
93eb6a44e280: Pushed 
7951de54e816: Pushed 
5a6e78989326: Pushed 
6bd7fb7b4551: Pushed 
3bedf5ae1d3d: Pushed 
32d65605e983: Layer already exists 
efa0b7a2d37b: Layer already exists 
fe548f92b224: Layer already exists 
a7d53ea16e81: Mounted from boiling-anchorage-81724/local 
e53f74215d12: Layer already exists 
latest: digest: sha256:442023d6d8a81296f8506b34bda803039c04666db42daf9ca86b8066deb05da5 size: 5943  

我相信Successfully built ...后面的字符串是图片ID。

其余的是什么?什么是图层?在对Dockerfile稍作修改后,它们似乎每次构建都会重建 对于"来自"是什么意思?

1 个答案:

答案 0 :(得分:1)

有关图层,请参阅“Images and layers”:

https://docs.docker.com/storage/storagedriver/images/container-layers.jpg

Docker镜像是从一系列图层构建的。每个图层代表图像Dockerfile中的指令。除最后一层之外的每一层都是只读的。

您可以see here docker push如何仅推送尚未在Docker注册表中的新图层。