有没有办法找到推送到 AWS ECR 的 Docker 映像的年龄?
当我请求图像清单时,aws ecr batch-get-image --repository some/repo --image-ids "imageDigest=sha256:abcdef..."
它会返回带有嵌入式清单的 AWS 回复。样本输出
{
"images": [
{
"registryId": "1234",
"imageId": {
"imageDigest": "sha256:abcdef...",
"imageTag": "latest"
}
},
"imageManifest": "<serialised JSON I'll paste below>"
"repositoryName": "some/repo"
}
],
"failures": []
}
AWS 响应中嵌入的序列化 JSON 看起来是这样的:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"config": {
"mediaType": "application/vnd.docker.container.image.v1+json",
"size": 123456,
"digest": "sha256:38f08cc551925935e235c5c94ab3fb89568bd286e3335aa2e05d7bd3ceee4574"
},
"layers": [
{
"mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"size": 573764,
"digest": "sha256:06dde66f337b57adcfca48b87d126b99a249765ccf2e09964584befc2890ae79"
}
]
}
我看不到任何元数据表明此图像何时被推送到 ECR。
事实证明我没有足够的权限(缺少ecr:ListImages)来使用
aws ecr describe-images
. 使用适当的权限,我可以运行该子命令并查看imagePushedAt
. 例如