ECR / Client / batch_get_image

batch_get_image#

ECR.Client.batch_get_image(**kwargs)#

Gets detailed information for an image. Images are specified with either an imageTag or imageDigest.

When an image is pulled, the BatchGetImage API is called once to retrieve the image manifest.

See also: AWS API Documentation

Request Syntax

response = client.batch_get_image(
    registryId='string',
    repositoryName='string',
    imageIds=[
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ],
    acceptedMediaTypes=[
        'string',
    ]
)
Parameters:
  • registryId (string) – The Amazon Web Services account ID associated with the registry that contains the images to describe. If you do not specify a registry, the default registry is assumed.

  • repositoryName (string) –

    [REQUIRED]

    The repository that contains the images to describe.

  • imageIds (list) –

    [REQUIRED]

    A list of image ID references that correspond to images to describe. The format of the imageIds reference is imageTag=tag or imageDigest=digest.

    • (dict) –

      An object with identifying information for an image in an Amazon ECR repository.

      • imageDigest (string) –

        The sha256 digest of the image manifest.

      • imageTag (string) –

        The tag used for the image.

  • acceptedMediaTypes (list) –

    The accepted media types for the request.

    Valid values: application/vnd.docker.distribution.manifest.v1+json | application/vnd.docker.distribution.manifest.v2+json | application/vnd.oci.image.manifest.v1+json

    • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'images': [
        {
            'registryId': 'string',
            'repositoryName': 'string',
            'imageId': {
                'imageDigest': 'string',
                'imageTag': 'string'
            },
            'imageManifest': 'string',
            'imageManifestMediaType': 'string'
        },
    ],
    'failures': [
        {
            'imageId': {
                'imageDigest': 'string',
                'imageTag': 'string'
            },
            'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag'|'ImageReferencedByManifestList'|'KmsError',
            'failureReason': 'string'
        },
    ]
}

Response Structure

  • (dict) –

    • images (list) –

      A list of image objects corresponding to the image references in the request.

      • (dict) –

        An object representing an Amazon ECR image.

        • registryId (string) –

          The Amazon Web Services account ID associated with the registry containing the image.

        • repositoryName (string) –

          The name of the repository associated with the image.

        • imageId (dict) –

          An object containing the image tag and image digest associated with an image.

          • imageDigest (string) –

            The sha256 digest of the image manifest.

          • imageTag (string) –

            The tag used for the image.

        • imageManifest (string) –

          The image manifest associated with the image.

        • imageManifestMediaType (string) –

          The manifest media type of the image.

    • failures (list) –

      Any failures associated with the call.

      • (dict) –

        An object representing an Amazon ECR image failure.

        • imageId (dict) –

          The image ID associated with the failure.

          • imageDigest (string) –

            The sha256 digest of the image manifest.

          • imageTag (string) –

            The tag used for the image.

        • failureCode (string) –

          The code associated with the failure.

        • failureReason (string) –

          The reason for the failure.

Exceptions

  • ECR.Client.exceptions.ServerException

  • ECR.Client.exceptions.InvalidParameterException

  • ECR.Client.exceptions.RepositoryNotFoundException

Examples

This example obtains information for an image with a specified image digest ID from the repository named ubuntu in the current account.

response = client.batch_get_image(
    imageIds=[
        {
            'imageTag': 'precise',
        },
    ],
    repositoryName='ubuntu',
)

print(response)

Expected Output:

{
    'failures': [
    ],
    'images': [
        {
            'imageId': {
                'imageDigest': 'sha256:example76bdff6d83a09ba2a818f0d00000063724a9ac3ba5019c56f74ebf42a',
                'imageTag': 'precise',
            },
            'imageManifest': '{\n "schemaVersion": 1,\n "name": "ubuntu",\n "tag": "precise",\n...',
            'registryId': '244698725403',
            'repositoryName': 'ubuntu',
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}