在CLI中,我可以docker inspect --type image {some_image}
,部分答案是:
"ContainerConfig": {
"Hostname": "4beccaca9c40",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/bin/sh\" \"-c\" \"cat /marker\"]"
],
"ArgsEscaped": true,
"Image": "sha256:111ecb4a6197242745f0d74c2ca4e377cfe4a1686b33160d3a8df3d3d1baea58",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"key1": "LabelValue1-L2",
"version": "1.2.0"
}
},
registry API定义了答案类型
- application / vnd.docker.container.image.v1 + json:Container config JSON
但我无法将其与特定API相关联。当我使用../manifests/..
URL时,我会以默认格式(application/vnd.docker.distribution.manifest.v1+json
)收到答案(如果我尝试使用" fat manifest"格式,也会发生这种情况)。 / p>
这个配置信息是否可以在某处获得?
注册表是几天前提取的标准注册表图像("Created": "2018-01-10T01:22:39.470942376Z"
)
答案 0 :(得分:0)
因此,所需的是:
首次调用https://{registry}/v2/{imageName}/manifests/{tag}
,并将Accept
标头设置为application/vnd.docker.distribution.manifest.v2+json
这将返回一个JSON,其中config.mediaType
设置为V1清单的内容类型(据我所知,它始终为application/vnd.docker.container.image.v1+json
)。
对https://{registry}/v2/{imageName}/manifests/{tag}
的第二次调用,其Accept
标头设置为上面获得的内容类型(相同的URL,只有Accept
更改)。
这将返回一个JSON,其中成员history
是一个列表,并且此列表的每个成员都有一个单独的v1Compatibility
属性,该属性是可以重新解析为JSON的字符串。 / p>