batch_delete_image

batch_delete_image(**kwargs)

Deletes a list of specified images that are within a repository in a public registry. Images are specified with either an imageTag or imageDigest .

You can remove a tag from an image by specifying the image's tag in your request. When you remove the last tag from an image, the image is deleted from your repository.

You can completely delete an image (and all of its tags) by specifying the digest of the image in your request.

See also: AWS API Documentation

Request Syntax

response = client.batch_delete_image(
    registryId='string',
    repositoryName='string',
    imageIds=[
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ]
)
Parameters
  • registryId (string) -- The Amazon Web Services account ID that's associated with the registry that contains the image to delete. If you do not specify a registry, the default public registry is assumed.
  • repositoryName (string) --

    [REQUIRED]

    The repository in a public registry that contains the image to delete.

  • imageIds (list) --

    [REQUIRED]

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

    • (dict) --

      An object with identifying information for an Amazon ECR image.

      • imageDigest (string) --

        The sha256 digest of the image manifest.

      • imageTag (string) --

        The tag that's used for the image.

Return type

dict

Returns

Response Syntax

{
    'imageIds': [
        {
            'imageDigest': 'string',
            'imageTag': 'string'
        },
    ],
    'failures': [
        {
            'imageId': {
                'imageDigest': 'string',
                'imageTag': 'string'
            },
            'failureCode': 'InvalidImageDigest'|'InvalidImageTag'|'ImageTagDoesNotMatchDigest'|'ImageNotFound'|'MissingDigestAndTag'|'ImageReferencedByManifestList'|'KmsError',
            'failureReason': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    • imageIds (list) --

      The image IDs of the deleted images.

      • (dict) --

        An object with identifying information for an Amazon ECR image.

        • imageDigest (string) --

          The sha256 digest of the image manifest.

        • imageTag (string) --

          The tag that's used for the image.

    • failures (list) --

      Any failures associated with the call.

      • (dict) --

        An object that represents an Amazon ECR image failure.

        • imageId (dict) --

          The image ID that's associated with the failure.

          • imageDigest (string) --

            The sha256 digest of the image manifest.

          • imageTag (string) --

            The tag that's used for the image.

        • failureCode (string) --

          The code that's associated with the failure.

        • failureReason (string) --

          The reason for the failure.

Exceptions

  • ECRPublic.Client.exceptions.ServerException
  • ECRPublic.Client.exceptions.InvalidParameterException
  • ECRPublic.Client.exceptions.RepositoryNotFoundException
  • ECRPublic.Client.exceptions.UnsupportedCommandException