所以我有一个连接到私有docker注册表的Kubernetes集群。我在Kubernetes中的一个节点在拉取图像时总是失败。因此,我进入节点并尝试手动拉取图像。当我尝试拉取图像时,它失败了。我收到以下错误:摘要sha256的文件系统层验证失败:...
我尝试了以下帖子,但其中的解决方案都不起作用:filesystem layer verification failed for digest
发布于 2021-09-30 16:38:46
我有一个私有的docker注册表,一个层在下载后没有通过验证,上面的解决方案对我都不起作用。
我做了以下操作,从私有docker注册表中删除图像和特定层。重新启动私有docker注册表。然后重新构建并再次推送映像。它应该会在之后工作。
要从私有docker注册表中删除标记,我使用以下脚本(Python):
image = "yourimage"
tag = "yourtag"
host = "https://yourhost:5000" # change to http if you have no ssl
username = "yourusername"
password = "yourpassword"
res = requests.get("{}/v2/{}/manifests/{}".format(host, image, tag), auth=HTTPBasicAuth(username, password), verify=False, headers={
"Accept": "application/vnd.docker.distribution.manifest.v2+json"
})
digest = res.headers.get("Docker-Content-Digest").replace('"', "")
res = requests.delete("{}/v2/{}/manifests/{}".format(host, image, digest), auth=HTTPBasicAuth(username, password), verify=False)
print(res.status_code)
要删除blob,您的blob摘要是sha256:....在验证时失败
image = "yourimage"
host = "https://yourhost:5000" # change to http if you have no ssl
username = "yourusername"
password = "yourpassword"
blob_digest = "yourblobdigest"
res = requests.delete("{}/v2/{}/blobs/{}".format(host, image, blob_digest), auth=HTTPBasicAuth(username, password),
verify=False)
完成此操作后,转到私有docker注册表的容器并像这样删除镜像:
rm /var/lib/registry/docker/registry/v2/repositories/your-repository-name
退出docker注册表并重新启动私有docker注册表容器。构建并推送映像,当您再次拉入时,一切都会正常进行。
https://stackoverflow.com/questions/69395952
复制相似问题