【发布时间】:2020-03-28 03:18:43
【问题描述】:
当我docker pull hello-world时,我得到了带有f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e摘要的图像
$ docker pull hello-world
Using default tag: latest
latest: Pulling from library/hello-world
Digest: sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e
Status: Image is up to date for hello-world:latest
docker.io/library/hello-world:latest
我用的是Mac,但是当我docker inspect hello-world:latest时,我看到os/arch是linux/amd64
...
"Architecture": "amd64",
"Os": "linux",
...
所以我去了https://hub.docker.com/_/hello-world/?tab=tags,发现很奇怪,最新的 linux/amd64 hello-world 位于https://hub.docker.com/layers/hello-world/library/hello-world/latest/images/sha256-92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a?context=explore,摘要为92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
所以我也拉下了这张图片
$ docker pull hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a: Pulling from library/hello-world
Digest: sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
Status: Downloaded newer image for hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
docker.io/library/hello-world@sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a
令人惊讶的是,我最终得到了两张具有相同标签、相同图像 ID、但摘要不同的图像。
$ docker image ls --digests
REPOSITORY TAG DIGEST IMAGE ID CREATED SIZE
hello-world latest sha256:92c7f9c92844bbbb5d0a101b22f7c2a7949e40f8ea90c8b3bc396879d95e899a fce289e99eb9 15 months ago 1.84kB
hello-world latest sha256:f9dfddf63636d84ef479d645ab5885156ae030f611a56f3a7ac7f2fdd86d7e4e fce289e99eb9 15 months ago 1.84kB
这两张图是同一张吗?如果我想在整个团队中保持一致性,我如何才能唯一地处理图像?
【问题讨论】:
-
类似问题仍然在 github 上打开。 github.com/moby/moby/issues/36789
-
@nischaygoyal 是的,但这似乎与 moby 无关。
-
@wlnirvana: Moby 肯定是 Docker 的上游项目...