how to list images available in a public amazon ecr repo?

2.5k Views Asked by At

i'd like use the aws cli to list images available here: https://gallery.ecr.aws/lambda/nodejs

when i try the following command:

aws ecr-public describe-image-tags --repository-name lambda/nodejs

i get this error:

User: arn:aws:sts::<my-session> is not authorized to perform: \
ecr-public:DescribeImageTags on resource: arn:aws:ecr-public::<my-account>:repository/lambda/nodejs

how do i specify the aws public repository, and not one of my own?

the api docs mention a --registry-id option, to supply an account ID, or if left blank "..the default public registry is assumed", but it seems like my account info is still being inserted.

Q: can someone provide a working example of a command that lists each of (or the first pagination of) the tags in the Image tags panel of a repo in the Amazon ECR Public Gallery?

3

There are 3 best solutions below

0
On BEST ANSWER

At time of writing, this can only be found by visiting the ECR Public gallery. There is no way to programmatically get a list of tags in ECR Public for a repository you haven't been explicitly granted API access to. Here's the relevant roadmap item https://github.com/aws/containers-roadmap/issues/1262

0
On

Actually AWS CLI supports the Public Repositories you created, which are linked with your account. Like I created a repository named randomname and I was able to list images under that.

$ aws ecr-public describe-images --repository-name randomname
{
    "imageDetails": [...]
}

Amazon ECR public registries

You can use your public registry to manage public image repositories consisting of Docker and Open Container Initiative (OCI) images. Each AWS account is provided with a default public and private Amazon ECR registry

To be more specific this part you see in the AWS Console

enter image description here

enter image description here

0
On

For future reference, the tags listing API is now available in ECR Public: https://github.com/aws/containers-roadmap/issues/1262