Reputation: 509
Before, I list the images by the API:
curl docker-registry:5000/v2/_catalog
{"repositories":
["tmp.eium.ems"]
}
Then I find the image digest by:
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"
},
...
Then I delete it with CLI:
[root@snap460c04 tmp]# curl -X DELETE docker-registry:5000/v2/tmp.eium.ems/blobs/sha256:8e9a0dfac41f87fdb04e2e9ab7bb64750e71ee58701f024e498fdbcf69c2d082
No any errors. But while I check it, the image is still there:
[root@snap460c04 tmp]# curl docker-registry:5000/v2/_catalog
{"repositories":["tmp.eium.ems"]}
Cannot anybody help?
I think my deletion did work, because if I execute the delete again, an error is reported:
[root@snap460c04 tmp]# curl -X DELETE docker-registry:5000/v2/tmp.eium.ems/manifests/sha256:8e9a0dfac41f87fdb04e2e9ab7bb64750e71ee58701f024e498fdbcf69c2d082
{"errors":[{"code":"MANIFEST_UNKNOWN","message":"manifest unknown"}]}
Upvotes: 4
Views: 3241
Reputation: 3995
You may not be using the correct digest for the deletion, or be missing a second one to also delete.
Using "Accept: application/vnd.docker.distribution.manifest.list.v2+json"
header could (have) return(ed) another digest to be deleted for the full tag removal.
regclient does the job:
regctl tag delete docker-registry:5000/tmp.eium.ems:latest
Upvotes: 2
Reputation: 6079
The Docker Registry just removed the manifests, but not the blobs of the image. There's still work to do in order to properly remove images. At this moment, the garbage collector does not collect untagged manifests.
I have implemented a script to remove untagged or specific images from the Registry.
Details at:
https://github.com/ricardobranco777/clean_registry
Upvotes: 2