在远程Docker注册表上删除Docker存储库 [英] remove docker repository on remote docker registry

查看:101
本文介绍了在远程Docker注册表上删除Docker存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的情况下,

curl -X GET localhost:5000/v2/_catalog
{"repositories":["repo1", "repo2", "repo3"]}

我想删除存储库 repo1 以便 _catalog 看起来像

I want to remove repository repo1 so that _catalog looks like

curl -X GET localhost:5000/v2/_catalog
{"repositories":["repo2", "repo3"]}

我们可以看到 repo1 似乎只有默认的最新 图像标签。

We can see repo1 appears to have only the default "latest" image tag.

curl -X GET localhost:5000/v2/repo1/tags/list
{"name":"repo1","tags":["latest"]}

(也许会影响能够删除 repo1 ?)

(Maybe that affects being able to delete repo1?)


以下命令返回了 404页面未找到

curl -X DELETE localhost:5000/v1/repositories/repo1
curl -X DELETE localhost:5000/v2/repositories/repo1
curl -X DELETE localhost:5000/v2/repo1

以下内容返回 {错误:[{代码: UNSUPPORTED,消息:不支持该操作。}}}

curl -X DELETE localhost:5000/v2/repo1/manifests/latest



使用



docker-registry是 registry / 2.0

curl -vX GET localhost:5000/v2/
< HTTP/1.1 200 OK
...
< Docker-Distribution-Api-Version: registry/2.0
...

/bin/registry github.com/docker/distribution v2.4.1


推荐答案

通过启用DELETE API,您只能从 v2中删除TAG,而不是整个存储库/ _catalog

by enabling DELETE API you're only able to delete the TAG not the whole repository from v2/_catalog.

为此,您应该:

< br>
1。启用DELETE API:

1.1通过 config.yml 存储。 delete.enabled:true

1.2 by env: -e REGISTRY_STORAGE_DELETE_ENABLED = true

1.2 by env: -e REGISTRY_STORAGE_DELETE_ENABLED=true

2。通过 GET / v2 /< name> / manifests /< tag>
获得标签参考
(不要忘记标题 Accept:application / vnd.docker.distribution.manifest.v2 + json )。

2. get the tag reference via GET /v2/<name>/manifests/<tag> (don't forget to have Header Accept: application/vnd.docker.distribution.manifest.v2+json).

在响应标头中,您有 docker-content-digest:< sha256:xxx>

3。发送 删除/ v2 /< name> / manifests /< sha256:xxx>

4。运行垃圾收集器: bin / registry垃圾收集/etc/docker/registry/config.yml

5。删除文件: rm -r / var / lib / registry / docker / registry / v2 / repositories /< name> /< tag>



最后:现在,您可以看到

curl -X GET localhost:5000 / v2 / _catalog
{ repositories:[ repo2, repo3]}




ps。

后果5: https://github.com/docker/distribution/issues/2983#issuecomment-530251232

这篇关于在远程Docker注册表上删除Docker存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆