Can't delete Docker Image from Registry

2020-02-15 05:00发布

Hi I want to delete a docker image from my private registry the steps that I did was:

I already did what the solution of How can I use the Docker Registry API V2 to delete an image from a private registry? recommended and it did not work

  • I did a HEAD request to get the 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

  • Then using the Dcker-content-digest from the previous step I did a delete request:

    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

  • I got this error:

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

1条回答
祖国的老花朵
2楼-- · 2020-02-15 06:01

In all likelihood, it means, that you have deleted the manifest, and this is right first step. To delete actual data from disk, you need to run docker registry garbage collector on registry host machine.

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

The info is from that comment

Also, as some adv, I want to propose you to check my docker registry web UI =) There is the possibility to delete an images from registry right with that UI.

查看更多
登录 后发表回答