StefanScherer / dockerfiles-windows

Various Dockerfiles for Windows Containers
MIT License
1.11k stars 396 forks source link

docker registry remove tags #386

Closed ghost closed 5 years ago

ghost commented 5 years ago

I have your docker registry running. I have successfully pushed some images with different tags. Accidentally I mistyped a tag and push that image. Question: how can I remove this mistyped tags from the registry? I only want to remove the tag, not the image files.

Found some tips in https://stackoverflow.com/questions/25436742/how-to-delete-images-from-a-private-docker-registry and https://github.com/docker/docker-registry/issues/988 and https://serverfault.com/questions/750094/remove-tagged-docker-image-from-private-registry and converted curl to invoke-webrequest: Working: Invoke-WebRequest -Method Get -Uri https://dockerregistry.is.cosinus/v2/businesscentral/onprem/tags/list Invoke-WebRequest -Method Get -Uri https://dockerregistry.is.cosinus/v2/businesscentral/onprem/manifests/de From the last one I got the Docker-Content-Digest for the following: Invoke-WebRequest -Method Delete -Uri https://dockerregistry.is.cosinus/v2/businesscentral/onprem/manifests/sha256:5d56bf354da17e81fae59171a0c11fdec06f94645bcc0bde8467e750670f6478 Invoke-WebRequest -Method Delete -Headers @{"Accept" = "application/vnd.docker.distribution.manifest.v2+json"} -Uri https://dockerregistry.is.cosinus/v2/businesscentral/onprem/manifests/sha256:5d56bf354da17e81fae59171a0c11fdec06f94645bcc0bde8467e750670f6478 Both are not working. Invoke-WebRequest` : {"errors":[{"code":"UNSUPPORTED","message":"The operation is unsupported."}]} In Zeile:1 Zeichen:1 Invoke-WebRequest -Method Delete -Uri https://dockerregistry.is.cosin ... CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

StefanScherer commented 5 years ago

Thanks ;-)

I don't know how to remove only the tag, I thought of https://github.com/genuinetools/reg, but this also removes the image. Maybe there are other command line tools to help you.

StefanScherer commented 5 years ago

Closing this as it is no bug in the Dockerfile for the registry. But if you find any information how to do it you may add it for the community where to find a suitable tool or way to do it.