I currently have a scenario where I wish to delete specific tags from an ECR repo. The correct thing to do here appears to be to map tags to digests then use these digests with the manifest deletion endpoint, However, this doesn't seem to be possible with Docker.Registry.Net. Although I am able to enumerate the tags with ListTags, GetDigest returns a null value, I believe because ECR does not return a Docker-Content-Digest header for the request.
From my reading of the Docker registry API specification the presence of the Docker-Content-Digest header is guaranteed only when doing a HEAD request to /v2/<name>/manifests/<reference>, however the GetDigest function calls MakeManifestRequest which always performs a GET request. For similar reasons GetManifest also fails when passed a tag, because it uses GetDigest to map tags to digests.
I confirmed with curl that performing a HEAD request to manifest endpoint did return the Docker-Content-Digest header but not with a GET request. The fix would appear to be modifying GetDigest to perform a HEAD request rather than a GET.
I currently have a scenario where I wish to delete specific tags from an ECR repo. The correct thing to do here appears to be to map tags to digests then use these digests with the manifest deletion endpoint, However, this doesn't seem to be possible with Docker.Registry.Net. Although I am able to enumerate the tags with
ListTags,GetDigestreturns a null value, I believe because ECR does not return aDocker-Content-Digestheader for the request.From my reading of the Docker registry API specification the presence of the
Docker-Content-Digestheader is guaranteed only when doing aHEADrequest to/v2/<name>/manifests/<reference>, however theGetDigestfunction callsMakeManifestRequestwhich always performs aGETrequest. For similar reasonsGetManifestalso fails when passed a tag, because it usesGetDigestto map tags to digests.I confirmed with curl that performing a
HEADrequest to manifest endpoint did return theDocker-Content-Digestheader but not with aGETrequest. The fix would appear to be modifyingGetDigestto perform aHEADrequest rather than aGET.