gpt4 book ai didi

DockerHub:sha 摘要不匹配

转载 作者:行者123 更新时间:2023-12-02 18:18:39 25 4
gpt4 key购买 nike

我想确定 DockerHub 中最新 docker 镜像的 sha 摘要:

如果我尝试拉取最新图像,我可以看到摘要

# docker pull mysql:latest
...
Digest: sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169
Status: Downloaded newer image for mysql:latest
docker.io/library/mysql:latest

所以摘要是 c93ba1
但如果我去 https://hub.docker.com 我会看到

enter image description here

所以有 2 个摘要: 511ca265b41c9a355d5c4ec0

此外,如果我尝试使用任何指定的摘要:
# docker pull mysql@sha256:9a355d5c4ec0351a954b11b494c597cd4e6ab2c8a04ce69c5f8332819890c43e
Error response from daemon: manifest for mysql@sha256:9a355d5c4ec0351a954b11b494c597cd4e6ab2c8a04ce69c5f8332819890c43e not found: manifest unknown: manifest unknown
# docker pull mysql@sha256:511ca265b41cabb694fda409b8ae87fb0a83db15cfb8429d581c33c7aafacddf
Error response from daemon: manifest for mysql@sha256:511ca265b41cabb694fda409b8ae87fb0a83db15cfb8429d581c33c7aafacddf not found: manifest unknown: manifest unknown

但是,如果我尝试使用从 pull 命令中获得的那个,它会起作用:
docker pull mysql@sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169
sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169: Pulling from library/mysql
Digest: sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169
Status: Image is up to date for mysql@sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169
docker.io/library/mysql@sha256:c93ba1bafd65888947f5cd8bd45deb7b996885ec2a16c574c530c389335e9169

我做错了什么?
有没有办法在不拉图像的情况下获取摘要?

更新:
使用 Docker Desktop 2.2 在 MacO 上再次重复相同的过程
docker pull mysql:8
8: Pulling from library/mysql
...
Digest: sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe
Status: Downloaded newer image for mysql:8
docker.io/library/mysql:8

然后在码头集线器上
enter image description here

然后
docker image inspect mysql:8
[
{
"Id": "sha256:c8ad2be69a220e93826a6308458627b8d5624dc981050fabf950e5de5a7a08a8",
"RepoTags": [
"mysql:8"
],
"RepoDigests": [
"mysql@sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe"
]


docker pull mysql@sha256:a592539c5a616b6642bb48822688b6917b373a1293638f9268e8da33e5e9dd1c
sha256:a592539c5a616b6642bb48822688b6917b373a1293638f9268e8da33e5e9dd1c: Pulling from library/mysql
Digest: sha256:a592539c5a616b6642bb48822688b6917b373a1293638f9268e8da33e5e9dd1c
Status: Downloaded newer image for mysql@sha256:a592539c5a616b6642bb48822688b6917b373a1293638f9268e8da33e5e9dd1c
docker.io/library/mysql@sha256:a592539c5a616b6642bb48822688b6917b373a1293638f9268e8da33e5e9dd1c
docker pull mysql@sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe
sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe: Pulling from library/mysql
Digest: sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe
Status: Image is up to date for mysql@sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe
docker.io/library/mysql@sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe

当我在Linux VM上执行相同操作时:
sudo docker pull mysql:8
8: Pulling from library/mysql
...
Digest: sha256:f91e704ffa9f19b9a267d9321550a0772a1b64902226d739d3527fd6edbe3dfe
Status: Downloaded newer image for mysql:8
docker.io/library/mysql:8

所以我不知道这里发生了什么

最佳答案

根据 this github comment ,显然 CLI 在计算 sha256 摘要时使用包含所有不同机器架构选项的 list ,而 DockerHub 页面上的每个摘要都是使用仅具有特定单个架构的 list 计算的。
IMO,这是不必要的困惑,应该调整两者之一,以便它们匹配或标记得更好。
更新:
我已经有一段时间没有追踪到这个了,所以我不记得细节了,但有关更多信息,请查看 this page 。我相信这与图像 list 的 sha 和 list 列表的 sha 之间的区别有关...

关于DockerHub:sha 摘要不匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59463729/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com