获取docker映像摘要

问题描述 投票:0回答:1

[执行docker images --digests时,我获得alpine:latest图像的以下信息:

sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54

执行docker image inspect alpine:latest时,我可以找到相同的信息,并查看JSON路径RepoDigests[0]

如何使用Docker registry API从注册表中获取完全相同的信息?

我尝试了以下操作:

# Authenticate (https://docs.docker.com/registry/spec/auth/token/)
curl -i "https://auth.docker.io/token?service=registry.docker.io&scope=repository:alpine:pull"

# Parse the token from the JSON result, JSON path: "token"
export TOKEN=<token>

# Query the manifest (https://docs.docker.com/registry/spec/api/)
curl -i -H "Authorization: Bearer $TOKEN" https://registry-1.docker.io/v2/library/alpine/manifests/latest

根据文档,响应头Docker-Content-Digest应该包含摘要,但是,值不同(但可能是清单的摘要,而不是图像的摘要?)。生成的JSON文件也不包含图像摘要。在哪里?

如何以编程方式获得与上述相同的摘要?我需要上面的一个,因为这是将docker trust sign放入签名中的一个,我想自己实现签名过程。

rest docker docker-registry
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.