Docker Registry v2镜像无法被删除。

4

在此之前,我通过API按图像排序:

   curl docker-registry:5000/v2/_catalog
    {"repositories":
        ["tmp.eium.ems"]
    }

然后我通过以下方式找到镜像摘要:

curl -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -X GET http://docker-registry:5000/v2/tm
p.eium.ems/manifests/latest
{
   "schemaVersion": 2,
   "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
   "config": {
      "mediaType": "application/vnd.docker.container.image.v1+json",
      "size": 7440,
      "digest": "sha256:8e9a0dfac41f87fdb04e2e9ab7bb64750e71ee58701f024e498fdbcf69c2d082"
   },
...

然后我使用CLI删除它:

[root@snap460c04 tmp]# curl -X DELETE docker-registry:5000/v2/tmp.eium.ems/blobs/sha256:8e9a0dfac41f87fdb04e2e9ab7bb64750e71ee58701f024e498fdbcf69c2d082

没有任何错误。 但是当我检查它时,图片仍然存在:

[root@snap460c04 tmp]# curl docker-registry:5000/v2/_catalog
{"repositories":["tmp.eium.ems"]}

有人可以帮忙吗?

我认为我的删除操作已经生效了,因为如果我再次执行删除,会报错:

[root@snap460c04 tmp]# curl -X DELETE docker-registry:5000/v2/tmp.eium.ems/manifests/sha256:8e9a0dfac41f87fdb04e2e9ab7bb64750e71ee58701f024e498fdbcf69c2d082
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown"}]}
3个回答

2

链接显示404错误。 - Schuh
@Schuh 请使用 ricardobranco/clean_registry Docker 镜像代替。https://github.com/ricardobranco777/clean_registry - Ricardo Branco

2

您可能没有使用正确的摘要进行删除,或者缺少第二个摘要以便同时删除。 使用"Accept: application/vnd.docker.distribution.manifest.list.v2+json"头可以(已经)返回另一个要删除的摘要,以便完全删除标记。

regclient可以完成此任务:

regctl tag delete docker-registry:5000/tmp.eium.ems:latest

该命令仅删除了标签,图像仍然存在(或者至少它的名称还在)! - McLan

0

工具提供了这种能力,并且在我的验证中表现良好。


链接显示404错误。 - McLan

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接