1

从 DockerHub 拉取 Docker 镜像时,CLI 会显示几个进度条,每个进度条都有不同的 ID:

➜  docker pull training/sinatra
Using default tag: latest
latest: Pulling from training/sinatra
a3ed95caeb02: Pull complete
6e71c809542e: Downloading [============>                       ]  17.3 MB/67.48 MB
d196a7609355: Download complete
08f6dff5acea: Download complete
ce65532003d0: Downloading [==============================>     ] 19.24 MB/21.22 MB
54bcaa4d1a10: Downloading [=====>                              ] 25.39 MB/62.67 MB
8572ad96f6e1: Waiting

下载完成后,这些 ID 似乎都不是下载的图像 ID:

docker images
REPOSITORY               TAG                 IMAGE ID            CREATED             SIZE
...
training/webapp          latest              6fae60ef3446        16 months ago       348.8 MB
training/sinatra         latest              49d952a36c58        2 years ago         447 MB

下载过程中显示的 ID 代表什么?

4

3 回答 3

1

那些被拉的东西是层。每个图像由多个层组成,每个层都有一个 ID。图像也有一个 ID。如果您这样做docker images -a(对于所有人),那么您应该会在列表中看到其他提取的 ID。

于 2016-10-01T20:29:42.890 回答
1

简短回答:拉取图像时看到的 ID 是“摘要”,它是每个图像层的 SHA256 哈希。出现在本地图像列表中的图像 ID 也是一个“摘要”,该摘要实际上表示图像的 JSON 配置对象的 SHA256 哈希。

于 2016-10-01T20:36:48.073 回答
1

那些是层。图像由其他图像组成。所有图像代表“主图像”的层。例如,当您使用 Dockerfile 创建新映像时,Dockerfile 中的每一行都会创建一个新层。

有关图像和图层的更多信息,请参阅官方文档。

于 2016-10-01T20:36:59.937 回答