Docker Community Forums

Share and learn in the Docker community.

Docker Registry is not providing appropriate reference key through API's

Hi Folks,
I had launched the docker private registry in my local machine. When I was trying to delete docker images from the docker registry. I’m facing issue of an invalid digest. Later I observed that the digest generated while docker push and digest provided by registry API are not the same.

Here are the commands I have followed

Command used to launch registry: sudo docker run -d -p 5000:5000 --restart=always -e REGISTRY_STORAGE_DELETE_ENABLED=true --name registry registry:2

pushed some dummy image to registry: sudo docker push localhost:5000/registry:2 The push refers to repository [localhost:5000/registry] b3f465d7c4d1: Pushed a5f27630cdd9: Pushed 239a096513b5: Pushed f5b9430e0e42: Pushed 3e207b409db3: Pushed 2: digest: sha256:e09ed8c6c837d366a501f15dcb47939bbbb6242bf3886270834e2a0fa1555234 size: 1363

API used to get digest:curl -v -X GET http://localhost:5000/v2/registry/manifests/2
Note: Unnecessary use of -X or --request, GET is already inferred.

  • Trying 127.0.0.1…
  • Connected to localhost (127.0.0.1) port 5000 (#0)

GET /v2/registry/manifests/2 HTTP/1.1
Host: localhost:5000
User-Agent: curl/7.47.0
Accept: /

< HTTP/1.1 200 OK
< Content-Length: 6839
< Content-Type: application/vnd.docker.distribution.manifest.v1+prettyjws
< Docker-Content-Digest: sha256:3d148315485eb7ad0274f97b5826b87803145ca08590f5319787847629279329
< Docker-Distribution-Api-Version: registry/2.0
< Etag: “sha256:3d148315485eb7ad0274f97b5826b87803145ca08590f5319787847629279329”
< X-Content-Type-Options: nosniff
< Date: Fri, 18 Sep 2020 05:03:42 GMT
<

API used to Delete docker image: curl -v -X DELETE http://localhost:5000/v2/ubuntu/manifests/sha256:3d148315485eb7ad0274f97b5826b87803145ca08590f5319787847629279329 {"errors":[{"code":"DIGEST_INVALID","message":"provided digest did not match uploaded content"}]}

can someone help me to resolve this issue