containers-roadmap icon indicating copy to clipboard operation
containers-roadmap copied to clipboard

[ECR] [request]: batch-get-image does not return labels when imageDigest used instead of imageTag

Open CONJAUMCGCG opened this issue 6 years ago • 3 comments

batch-get-image does return labels with --image-id imageTag=<tag_name> option. But does not work if I pass --image-id imageDigest=<image_sha256> instead of the imageTag. aws ecr batch-get-image --repository-name <repo_name> --image-id imageDigest=<image_sha256> --accepted-media-types "application/vnd.docker.distribution.manifest.v1+json" --output json |jq -r '.images[].imageManifest' |jq -r '.history[0].v1Compatibility' |jq -r '.config.Labels'

CONJAUMCGCG avatar Sep 14 '20 19:09 CONJAUMCGCG

Fixing would benefit boto users as well. One can't make a request including both imageTag and imageDigest when using boto or the v1 json doesn't return.

Example:

# This is what you get when doing ecr.list_images
imageIds = {'imageDigest': "a-digest", 'imageTag': 'a-tag'}

# Does not return v1 json if included so has to be delete out.
del imageIds["imageDigest"]

ecr.batch_get_image(
    repositoryName=repo_name,
    # Can't pass the imageDigest in the dict or get v2 json back
    imageIds=imageIds,
    acceptedMediaTypes=[
        "application/vnd.docker.distribution.manifest.v1+json"
    ],
)

jmahlik avatar Nov 18 '20 20:11 jmahlik

Manifest translation is only available when pulling by tag, not digest (docs). If pulling by digest and a translation is performed, some clients will experience an error due to digest mismatch. What is the manifest format that the images were pushed as?

rpnguyen avatar Jan 14 '21 19:01 rpnguyen

Greetings! It looks like this issue hasn't been active for a while. Because it has been some time since the last update on this, and in the absence of more information, we will be closing this issue soon. Please feel free to provide a comment to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Feb 28 '21 20:02 github-actions[bot]