Can I get an image digest without downloading the image?

前端 未结 6 460
执念已碎
执念已碎 2021-02-01 09:00

Similar to the question \"What´s the sha256 code of a docker image?\", I would like to find the digest of a Docker image. I can see the digest when I download an image:

6条回答
  •  暖寄归人
    2021-02-01 09:25

    I encountered a task recently that required viewing the sha256 digest without necessarily pulling the image. The tool skopeo makes the registry API calls so you don't need to pull the image.

    For example,

    $ skopeo inspect --creds "username:password" docker://waisbrot/wait:latest
    

    You could then pipe this to jq if you want to get just the digest value.

    $ skopeo inspect --creds "username:password" \
      docker://waisbrot/wait:latest | jq -r '.Digest'
    sha256:6f2185daa4ab1711181c30d03f565508e8e978ebd0f263030e7de98deee5f330
    

提交回复
热议问题