从Docker Registry v2删除图像 [英] delete image from docker registry v2
问题描述
Docker Registry v2具有用于删除映像的API端点
the Docker Registry v2 has an API endpoint to delete an image
DELETE /v2/<name>/manifests/<reference>
https://github.com/docker/distribution/blob/master/docs/spec/api.md#deleting-an-image
但是文档说:
对于删除,引用必须是摘要,否则删除将失败.
For deletes, reference must be a digest or the delete will fail.
实际上,使用标记
无效,并返回 405不支持的操作
Indeed, using a tag
does not work and returns a 405 Operation Not Supported
问题是,似乎没有任何端点可以获取图像的 digest
.
The problem is, there doesn't seem to be any endpoint to get the digest
of an image.
列出图像的端点,而标签仅列出这些图像.
The endpoints to list images, and tags only list those.
尝试使用
GET /v2/<name>/manifests/<reference>
使用标记
作为< reference>
,我看到 Docker-Content-Digest
标头设置了 digest
是文档所说的
using the tag
as <reference>
I see that a Docker-Content-Digest
header is set with a digest
which the doc says is
Docker-Content-Digest:目标内容的摘要请求.
Docker-Content-Digest: Digest of the targeted content for the request.
体内包含一堆 blobSum:< digest>
如果我尝试使用标题摘要"值,则使用
If I try using the Header digest value, with
GET /v2/<name>/manifests/<reference>
和 digest
作为< reference>
,我得到 404
.
摘要如下所示: sha256:6367f164d92eb69a7f4bf4cab173e6b21398f94984ea1e1d8addc1863f4ed502
,我尝试使用和不使用 sha256
前缀.但没有运气
and I tried with and without the sha256
prefix. but no luck
那我应该如何获取要删除的图像的摘要
,将其删除?
So how am I supposed to get the digest
of the image I want to delete, to delete it?
推荐答案
curl -u login:password -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET https://registry.private.com/v2/<name>/manifests/<tag>
json>配置>摘要
json > config > digest
这篇关于从Docker Registry v2删除图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!