无法从Registry中删除Docker镜像

时间:2016-10-07 13:45:20

标签: docker docker-compose dockerfile docker-registry

您好我想从我的私人注册表中删除停靠者图像我执行的步骤是:

我已经完成了How can I use the Docker Registry API V2 to delete an image from a private registry?推荐的解决方案,但它没有用

  • 我做了一个HEAD请求来获取Docker-Content-Digest

    curl --cacert ~/Documents/certificates//ca.pem --key ~/Documents/certificates//key.pem --cert ~/Documents/certificates/certificate.p12 --pass certpass -I https://myprivateregistry/v2/imagename/manifests/tag

  • 然后使用上一步中的Dcker-content-digest我执行了删除请求:

    curl --cacert ~/Documents/certificates//ca.pem --key ~/Documents/certificates//key.pem --cert ~/Documents/certificates/certificate.p12 --pass certpass --header "Accept: application/vnd.docker.distribution.manifest.v2+json" -X DELETE https://myprivateregisty/v2/imagename/manifests/dockercontentdigestgotfrompreviousstep

  • 我收到了这个错误:

    {"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown"}]}

1 个答案:

答案 0 :(得分:0)

很可能,这意味着您已删除了清单,这是正确的第一步。要从磁盘中删除实际数据,您需要在注册表主机上运行docker registry garbage collector。

docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.yml

信息来自that comment

另外,作为一些副词,我想建议你检查我的docker registry web UI =)有可能从该UI中删除注册表中的图像。