Is it possible to remove a pushed image from Google Container Registry?
I mean without handling the Google Cloud Storage directory directly.
Thanks!
With current UI and its implementation, you can only delete tags, the underlying images will not be deleted.
If it is a Docker V2 images, from command line you can delete the image using Docker Registry API , by deleting the tags first, and then deleting the manifest. More about this at the end of the reply.
If it is a Docker V1 image, there is no "docker" way to delete the image, but you can delete the image in GCS.
We are implementing new features that will enable you to delete V2 tags and images.
Details about deleting V2 images/tags from command line using Docker Registry V2 API:
export REGISTRY=gcr.io
export REPOSITORY=foo/bar
# Next line will dump all the manifests and the tags pointing to the manifests:
curl -u _token:$(gcloud auth print-access-token) https://$REGISTRY/v2/$REPOSITORY/tags/list 2>/dev/null | python -mjson.tool
# You will see output like this:
{
...
"manifest": {
"sha256:2aa676...": {},
"sha256:95de3c...": {
"tag": [
"centos7.0.1406",
"centos8.8",
...
]
},
...
},
"name": "foo/bar",
"tags": [
"centos7.0.1406",
"centos8.8",
...
]
}
# Find the image/manifest you want to delete, first delete all its tags,
# then delete the manifest, by using:
curl -X DELETE -u _token:$(gcloud auth print-access-token) https://$REGISTRY/v2/$REPOSITORY/manifests/xxxx
# where xxxx is the tag or manifest you want to delete
# (yes, you delete tag and manifest using the same REST api)