我需要一种方法将我的清单和所有相关的 blob/etc 从私有注册表复制到公共注册表,其中图像之前从未推送到公共注册表。
我正在通过buildah. 请注意,虽然映像是使用 buildah 构建的,但我会对基于 docker 的方法在注册表之间复制最终结果感到满意。这是来自的输出buildah inspect:
{
"schemaVersion": 2,
"manifests": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"digest": "sha256:e1c1de1b56adc07e5a97970b3340b1cf71c02796eb4e27c638634b6bcf0e510e",
"size": 5590,
"platform": {
"architecture": "amd64",
"os": "windows"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:c4bf2b94bbedceab3888544f4b966e8c1435231daeff27546acaf3b817485226",
"size": 511,
"platform": {
"architecture": "amd64",
"os": "linux"
}
}
]
}
实际上,还会有更多的排列方式……但这个简单的清单就说明了问题。
出于性能(和其他各种)原因,我的 CI 将此图像推送到本地注册表。一旦我测试了最终清单,我想docker.io用相同的标签将它推送到公共注册表。
在我将 Windows 添加到组合中之前,我能够通过拉取每个图像、使用新注册表重新标记它并推送来完成此操作。就像是...
buildah manifest create docker.io/img/name:latest
# Retag & add windows...
buildah pull myreg/img/name:windows
buildah tag myreg/img/name:windows docker.io/img/name:windows
buildah push docker.io/img/name:windows
buildah manifest add docker.io/img/name:latest docker.io/img/name:windows
# ... other variants ...
不幸的是,这不适用于 Windows。当 Linux 机器尝试拉取 Windows 映像时,我收到以下错误:
Error committing the finished image: error adding layer with blob "sha256:0363fe57a309a0e39c3dd1bb7be80beed88dcef74b1773ee1a37f6caf81e0fe2": Error processing tar file(exit status 1): link /Files/Program Files/common files/Microsoft Shared/Ink/en-US/micaut.dll.mui /Files/Program Files (x86)/common files/Microsoft Shared/ink/en-US/micaut.dll.mui: no such file or directory
我是否需要使用 Windows 机器进行重新标记位,将图像从本地注册表复制到公共注册表?或者有没有一种简单的方法来复制/镜像整个清单而不添加所有这些额外的拉/标签/推送步骤?