1

Since 1.10, Docker implements a content addressable method based on a secure hash of the image and layer data:

sudo docker pull redis:5.0.2-alpine
sudo docker inspect --format '{{json .RootFS }}' redis:5.0.2-alpine | jq .
{
  "Type": "layers",
  "Layers": [
    "sha256:df64d3292fd6194b7865d7326af5255db6d81e9df29f48adde61a918fbd8c332",
    "sha256:04c8ef03e9356ae0c559ecc63ef5ef7154d5da8d4bef48786a7f00f628047d88",
    "sha256:169a281fff0fef0bfbec6873d7f0b6d2cad3a67068d0f16e2d32259582a2b95c",
    "sha256:1943100a0dc33557faa38ea52c3c6e974c0311122fa0ca9c5d8e398ab532ff2b",
    "sha256:1a49f3e37547b9141b4a5f78aaedb0ddcbfc8871466bbc3d3d8b8dba420c154a",
    "sha256:ba1d81ed872f9f31960e964cf6d00c77a668fd04ab0277ece2273dbb85003910"
  ]
}

But is there a way to match the layers digest with an image name, either locally downloaded or in some repository?

As far as I can tell, docker search does not allow searching by digest. Or does it?

1
  • Hi and welcome! :-) What is your actual goal here? I.e why would smb need that? (use case) Dec 11 '18 at 4:21
1

The mapping between image manifest and layers goes the other way. You can have one or more image manifests pointing to a layer. And those images may not even be tagged with an image name, or a single image may have multiple tags. So I'm not aware of an easy way to do a reverse search. You would need to go through each image on the local system or registry to see what images point to that layer, and then search the tags to see what names that image has.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.