aws Verified current stable Not installed? Containers

Aws / List Images In Repository

List Images In Repository

Lists all images in a specified ECR repository along with their details.

$
Terminal
aws ecr list-images --repository-name <repository>

When To Use

When conducting audits or evaluations of containerization strategy and image usage.

Pro Tip

Pipe the output through `jq` for easier readability and customization of output format.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
aws ecr list-images --repository-name <repository>

Terminal Output

Expected runtime feedback

Simulated preview
>
Output
{
    "imageIds": [
        {
            "imageDigest": "sha256:abc123...",
            "imageTag": "latest"
        },
        {
            "imageDigest": "sha256:def456...",
            "imageTag": "v1.0"
        }
    ],
    "nextToken": null
}

Anatomy of Output

Understanding the result

{ "imageDetails": [ { "imageDigest": "sha256:abc123...", "imageTag": "latest", "imagePushedAt": "2021-01-01T10:00:00Z", "imageSizeInBytes": 2048 } ] } Image Details Output

Lists the image digest, tag, pushing date, and size for each image.

{ "failures": [] } Operation Summary

Confirms whether or not the operation encountered any failures.

Troubleshooting

Common pitfalls

An error occurred (RepositoryNotFoundException) when calling the ListImages operation: The specified repository does not exist.

Solution: Ensure the repository name is correct.

An error occurred (UnauthorizedException) when calling the ListImages operation: User is not authorized to perform this operation.

Solution: Check the IAM permissions for ListImages on the ECR.

An error occurred (InvalidParameterException) when calling the ListImages operation: Invalid parameter specified.

Solution: Verify that the repository name is correctly formatted.

Command Breakdown

What each part is doing

aws
Base Command
The executable that performs this operation. Here it runs Aws before the shell applies any redirect operators.
<repository>
repository
The value supplied for repository.
--repository-name
Command Option
Tool-specific option used by this command invocation.

How To Run

Execution path

  1. Step 1

    Run the command: aws ecr list-images --repository-name my-repo

  2. Step 2

    Verify the output for image details and tags.

Alternative Approaches

Comparable commands in other tools

Alternative containers tools for the same job.