在哪里可以找到 docker 镜像的 sha256 代码? [英] Where can I find the sha256 code of a docker image?

查看:367
本文介绍了在哪里可以找到 docker 镜像的 sha256 代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用它们的 sha256 代码提取 CentOS、Tomcat 的映像,例如

docker pull myimage@sha256:0ecb2ad60

但是我找不到可以在任何地方使用的 sha256 代码.

我检查了 DockerHub 存储库以获取 sha256 代码的任何提示,但找不到任何提示.我按标签下载了图片

docker pull tomcat:7-jre8

并使用docker inspect检查图像以查看元数据中是否有sha256代码,但没有(添加图像的sha256代码可能会更改sha256代码).

我是否必须自己计算图像的 sha256 代码并使用它?

解决方案

刚看到:

当我拉图片时,sha256 代码显示在输出的底部(摘要:sha ....):

docker pull tomcat:7-jre87-jre8:从库/tomcat 中拉取902b87aaaec9:已经存在9a61b6b1315e:已经存在...4dcef5c50d60:已经存在摘要:sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f状态:图像是最新的 tomcat:7-jre8

这个sha代码

<块引用>

sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f

可用于随后使用

拉取图像<块引用>

docker pull tomcat@sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f

这样您就可以确保图像不会被更改并且可以安全地用于生产.

I'd like to pull the images of CentOS, Tomcat, ... using their sha256 code, like in

docker pull myimage@sha256:0ecb2ad60

But I can't find the sha256-code to use anywhere.

I checked the DockerHub repository for any hint of the sha256-code, but couldn't find any. I downloaded the images by their tag

docker pull tomcat:7-jre8

and checked the image with docker inspect to see if there's a sha256 code in the metadata, but there is none (adding the sha256 code of the image would probably change the sha256 code).

Do I have to compute the sha256 code of an image myself and use that?

解决方案

Just saw it:

When I pull an image, the sha256 code is diplayed at the bottom of the output (Digest: sha....):

docker pull tomcat:7-jre8
7-jre8: Pulling from library/tomcat
902b87aaaec9: Already exists 
9a61b6b1315e: Already exists 
...   
4dcef5c50d60: Already exists 
Digest: sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f
Status: Image is up to date for tomcat:7-jre8

This sha code

sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f

can be used to pull the image afterwards with

docker pull tomcat@sha256:c34ce3c1fcc0c7431e1392cc3abd0dfe2192ffea1898d5250f199d3ac8d8720f

This way you can be sure that the image is not changed and can be safely used for production.

这篇关于在哪里可以找到 docker 镜像的 sha256 代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆