Answers: <p>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.</p>
  
Answers: CC BY-SA 4.0
Answers: 2018-12-10T21:06:17.833Z
Answers: 2018-12-10T21:06:17.833Z
Answers: BMitch
Body: <p>Since 1.10, Docker implements a content addressable method based on a secure hash of the image and layer data:</p>
  
  <pre><code>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"
    ]
  }
  </code></pre>
  
  <p>But is there a way to match the layers digest with an image name, either locally downloaded or in some repository?</p>
  
  <p>As far as I can tell, <a href="https://docs.docker.com/engine/reference/commandline/search" rel="noreferrer"><code>docker search</code></a> does not allow searching by digest. Or does it?</p>
  
Comments: CC BY-SA 4.0
Comments: 2018-12-11T04:21:15.003Z
Comments: Hi and welcome! :-) What is your actual goal  here? I.e why would smb need that? (use case)
Comments: Ta Mu
Tags: <docker>
Title: How to find the image name corresponding to a layer digest?
UserDisplayName: Sylvain Leroux
ThreadText: # How to find the image name corresponding to a layer digest?
  
  (Asked by: username_0 on 2018-12-10)
  
  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`](https://docs.docker.com/engine/reference/commandline/search) does not allow searching by digest. Or does it?
  
  **Tags:** docker
  
  > **Comments:**
  > **username_1**: Hi and welcome! :-) What is your actual goal  here? I.e why would smb need that? (use case)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2018-12-10. Score: 2
  
  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.
  
  
  ---
  
  