Docker Hub 上的 Jenkins docker 图像摘要与本地图像不匹配

Jenkins docker image digest on Docker Hub does not match the local image

我看到以下 Digest for Jenkins Docker 图片。

https://hub.docker.com/layers/jenkins/library/jenkins/2.60.3/images/sha256-cd14cecfdb3a657ba7d05bea026e7ac8b9abafc6e5c66253ab327c7211fa6281?context=explore

然而,当我拉取这个图像时,我得到了一个不同的摘要,即摘要不匹配。

docker pull jenkins:2.60.3

如您所见,摘要不匹配。

另一个问题是我无法在 Docker Hub 上找到最新 Jenkins docker 图像的 Digest SHA 值,如下所示。

https://hub.docker.com/_/jenkins?tab=tags

你能告诉我在哪里可以找到它吗?

有很多带图片的摘要,而您看到的是两个截然不同的摘要。在顶层有一个带有摘要的清单列表,您可以在 docker images 命令中看到它,此外还有平台特定清单的摘要(大多数人认为图像):

$ regctl image manifest --list jenkins:2.60.3
Name:        jenkins:2.60.3
MediaType:   application/vnd.docker.distribution.manifest.list.v2+json 
Digest:      sha256:eeb4850eb65f2d92500e421b430ed1ec58a7ac909e91f518926e02473904f668
                                                                                         
Manifests:
     
  Name:      docker.io/library/jenkins@sha256:0de43cde2c4b864a8e4a84bbd9958e47c5d851319f118203303d040b0a74f159
  MediaType: application/vnd.docker.distribution.manifest.v2+json
  Platform:  linux/amd64       

在映像清单中,还有映像配置和每个文件系统层的摘要。这些都打包为 blob,您正在查看的第二个摘要是这些文件系统层之一:

$ regctl image manifest docker.io/library/jenkins@sha256:0de43cde2c4b864a8e4a84bbd9958e47c5d851319f118203303d040b0a74f159
{                     
  "schemaVersion": 2,                                                                    
  "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
  "config": {
    "mediaType": "application/vnd.docker.container.image.v1+json",
    "size": 12976,
    "digest": "sha256:cd14cecfdb3a657ba7d05bea026e7ac8b9abafc6e5c66253ab327c7211fa6281"
  },
  "layers": [
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 45310044,
      "digest": "sha256:55cbf04beb7001d222c71bfdeae780bda19d5cb37b8dbd65ff0d3e6a0b9b74e6"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 10740168,
      "digest": "sha256:1607093a898cc241de8712e4361dcd907898fff35b945adca42db3963f3827b3"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 4336107,
      "digest": "sha256:9a8ea045c9261c180a34df19cfc9bb3c3f28f29b279bf964ee801536e8244f2f"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 50064642,
      "digest": "sha256:d4eee24d4dacb41c21411e0477a741655303cdc48b18a948632c31f0f3a70bb8"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 892350,
      "digest": "sha256:c58988e753d7a34080c68b53f7c27229d8f8fa80b9940c34d5cf77a9a2df10a0"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 246,
      "digest": "sha256:794a04897db9ebf95b1f6430cd4d4051bd227a5f0698b18404ccd4c59e43273d"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 131,
      "digest": "sha256:70fcfa476f730980d7a89f5ea34dd29c0c58e7cfe62652584e3adc38106e30ee"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 133944795,
      "digest": "sha256:0539c80a02be3183761cc42f94a4f9cd5e3bc455f4ac3f4ecaab6d476b7fe330"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 246694,
      "digest": "sha256:54fefc6dcf80a7be81ef627ec6ba8449a8ee7958a026ef947f99cac250af8f53"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 334,
      "digest": "sha256:911bc90e47a85cca565f7b14404e7a0473f56ad56fe64a7d6967db7fbd78fa76"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 4149,
      "digest": "sha256:38430d93efed3574476fb8f41057c2a02f17a21dc11affde95b8a8d52138d4e4"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 182,
      "digest": "sha256:7e46ccda148ad58d1c301ab1307a7b7aec50ae3ee4e39c1041c0836072bb64e4"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 354772,
      "digest": "sha256:c0cbcb5ac7477b970b1b8a3770fb53edee6d1006f47b3978c620bfc88db64fc7"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 433,
      "digest": "sha256:35ade7a86a8e486a2413dd7fc65392212edc7d55c892d3c9c18120176a6ccd6f"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 70409105,
      "digest": "sha256:aa433a6a56b1bdf8211085ff28d524a0988050e7b10bf24331417ff09c5b72cf"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 442,
      "digest": "sha256:841c1dd38d620cb787959646579e3b1aeed5c126160ba374026bd9c348b8b512"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 1439,
      "digest": "sha256:b865dcb08714ce7f0212fe30a08f7be313d8f1e0da826bef5c83fa7358276413"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 837,
      "digest": "sha256:5a37790300054f7050ee94ac24a0f2f0693b613f887b24814be44750b6ac2a51"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 1552,
      "digest": "sha256:12b47c68955c9d18c7e2058d3d349e70b600cee9fa38665e0fe2fdaacdd929a2"
    },
    {
      "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
      "size": 2626,
      "digest": "sha256:1322ea3e7bfdc77717f92042f9f69668a7b9698a8319eedf8b394542aa4e982e"
    }
  ]
}

由于清单包含层摘要列表和配置摘要,清单上的摘要唯一地保证了该图像的不可变内容。类似地,清单列表包含每个平台的清单摘要列表,因此该清单列表上的摘要唯一标识它引用的清单集。这是注册管理机构用来保证父摘要内容的有向无环图 (DAG) 和内容可寻址存储 (CAS)。