Aws-cli: wrong output if execute command `aws ecr describe-images`

Created on 20 Jun 2018  ·  6Comments  ·  Source: aws/aws-cli

I found an option mistake. Please, look below description.
At first, this command is good.

❯ aws ecr describe-images --repository-name <repositoryName> --profile <profile>
{
    "imageDetails": [
        {
            "registryId": "<resitryID>",
            "repositoryName": "<repositoryName>",
            "imageDigest": "sha256:***",
            "imageSizeInBytes": <imageSizeInBytes>,
            "imagePushedAt": <imagePushedAt>
...

next one not to use --repository-name option isn't good.

❯ aws ecr describe-images
...
aws: error: the following arguments are required: --repository-name

and document explains this.

❯ aws ecr describe-images help
...
OPTIONS
...
       --repository-name (string)
          A  list  of  repositories to describe. If this parameter is omitted,
          then all repositories in a registry are described.
...

ex)

# my developing environment
❯ aws --version
aws-cli/1.15.41 Python/3.6.5 Darwin/17.6.0 botocore/1.10.41
closing-soon documentation service-api

Most helpful comment

Trouble is, how do you list all the repo's without this command? We should not be changing the docs to match the code, but changing the code to match the docs

Thats how i do to list all repos

aws ecr describe-repositories |grep repositoryName |awk '{print $2}' |sort

All 6 comments

Thanks for reporting. We pull in that documentation upstream so I've created a ticket with the docs team to get that corrected.

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

Trouble is, how do you list all the repo's without this command? We should not be changing the docs to match the code, but changing the code to match the docs

Trouble is, how do you list all the repo's without this command? We should not be changing the docs to match the code, but changing the code to match the docs

Thats how i do to list all repos

aws ecr describe-repositories |grep repositoryName |awk '{print $2}' |sort

Trouble is, how do you list all the repo's without this command? We should not be changing the docs to match the code, but changing the code to match the docs

Thats how i do to list all repos

aws ecr describe-repositories |grep repositoryName |awk '{print $2}' |sort

Right horse for the course. Cheers

@Ian-T-Price if you want do take one step further and list all images for all repos you can do something like that

#!/bin/bash
AWS_REPOS=`aws ecr describe-repositories |grep repositoryName |awk '{print $2 }' |sed -e 's/\,//g' |sed -e 's/\"//g'`
for aws_repo_list in $AWS_REPOS; do
aws ecr describe-images --repository-name $aws_repo_list --output json
done

Hope it can help someone :)

Was this page helpful?
0 / 5 - 0 ratings