'Where can i find the digest for my docker image so I can delete it from the Registry?
Update
After reading the documentation a few more times, I realized I'b been looking in the wrong place for the digest. It is NOT in the manifest.
If you do a HEAD or GET on the v2/name/manifests/tag you will get a header (Docker-Content-Digest) which contains the digest:
Server nginx
Date Sat, 02 Nov 2019 19:01:16 GMT
Content-Type application/vnd.docker.distribution.manifest.v1+prettyjws
Content-Length 2839
Connection keep-alive
Docker-Content-Digest sha256:fcb864bea187b2efbf23d1032052461170fcb482e2dd99f9db5f9a8b538e553d
Docker-Distribution-Api-Version registry/2.0
Depending on the version of your Registry (or may be unrelated to that), the inclusion of a specific header at the time of sending GET or HEAD will cause a different digest to be returned.
This header is:
Accept: application/vnd.docker.distribution.manifest.v2+json
Even though the version of Registry that I'm dealing with is 2.0 inclusion of this header causes a different value to be returned for Docker-Content-Digest
Anyways, I tried both variations and I'm still not able to delete each time getting
{
"errors": [
{
"code": "DIGEST_INVALID",
"message": "provided digest did not match uploaded content"
}
]
}
Here's a link to the documenation in case someone's interested in it:
https://docs.docker.com/registry/spec/api/
Original
I have the following manifest which is downloaded for my image. I have tried every string here in place of the Digest but I have not been able to do that.
Could someone point out which one of these is the digest that i need for a Delete command?
I am using a DELETE http request with the following formulation:
https://my_registry.com/v2/demo/derivedimage/manifests/<whatever the digest is supposed to be here>
This is the error I get every time:
{
"errors": [
{
"code": "DIGEST_INVALID",
"message": "provided digest did not match uploaded content"
}
]
}
{
"schemaVersion": 1,
"name": "demo/derivedimage",
"tag": "4c3a6f78fe709a098a0d24a2c43639e7e170bc5981004554a154245662fea132",
"architecture": "amd64",
"fsLayers": [
{
"blobSum": "sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4"
},
{
"blobSum": "sha256:0f8c40e1270f10d085dda8ce12b7c5b17cd808f055df5a7222f54837ca0feae0"
}
],
"history": [
{
"v1Compatibility": "{\"architecture\":\"amd64\",\"config\":{\"Hostname\":\"\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"sh\"],\"ArgsEscaped\":true,\"Image\":\"sha256:02cc0eb9e9d093c512e57d613a9c1d89b0b50b551bbed33e3116459e7d15ee7e\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":null},\"container\":\"e24c19c10096d9b60b9ac2276cc24ec9a1ab93e8330dff511362b8e983a4e040\",\"container_config\":{\"Hostname\":\"e24c19c10096\",\"Domainname\":\"\",\"User\":\"\",\"AttachStdin\":false,\"AttachStdout\":false,\"AttachStderr\":false,\"Tty\":false,\"OpenStdin\":false,\"StdinOnce\":false,\"Env\":[\"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\"],\"Cmd\":[\"/bin/sh\",\"-c\",\"#(nop) \",\"CMD [\\\"sh\\\"]\"],\"ArgsEscaped\":true,\"Image\":\"sha256:02cc0eb9e9d093c512e57d613a9c1d89b0b50b551bbed33e3116459e7d15ee7e\",\"Volumes\":null,\"WorkingDir\":\"\",\"Entrypoint\":null,\"OnBuild\":null,\"Labels\":{}},\"created\":\"2019-10-30T23:20:37.206592274Z\",\"docker_version\":\"18.06.1-ce\",\"id\":\"d624e6ec746cd764114cfd7f4ab1fb0852e670c10df15adb1e75b4f99e4123be\",\"os\":\"linux\",\"parent\":\"9f31ac69fd90b9035252a2e1bac45e3d43b7d32316be7e4ac7a737d9d11b092b\",\"throwaway\":true}"
},
{
"v1Compatibility": "{\"id\":\"9f31ac69fd90b9035252a2e1bac45e3d43b7d32316be7e4ac7a737d9d11b092b\",\"created\":\"2019-10-30T23:20:37.083008444Z\",\"container_config\":{\"Cmd\":[\"/bin/sh -c #(nop) ADD file:1141b81e5149cc37c4346ee17e282cca8c7016a9bcfeb7a54842a87ecf8419d4 in / \"]}}"
}
],
"signatures": [
{
"header": {
"jwk": {
"crv": "P-256",
"kid": "3NQM:K5YD:M3XF:EKJD:4S64:3772:BJOT:JIMR:NX4R:2XYS:IDNA:NOKL",
"kty": "EC",
"x": "k6pZfyr-dKYLri5KJCL70UmNLCQnfUh2lAC_nDK9PVw",
"y": "MhrKOUbx1sgsbF0kG9d5bfvkVaxaFWiKlWTwgFyHkbQ"
},
"alg": "ES256"
},
"signature": "0TWLKZlltDA4kQJR4orhg7NenglG2OevQMSaN-RXCwFod7cyO5VFLVEeBDvsFhuAsvsw8mO475g1G9bW_Zh-aA",
"protected": "eyJmb3JtYXRMZW5ndGgiOjIxOTIsImZvcm1hdFRhaWwiOiJDbjAiLCJ0aW1lIjoiMjAxOS0xMS0wMVQwNDowMTowNloifQ"
}
]
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
