logo image

Amazon ECRのpublicリポジトリへdocker imageをpushしようとした際のエラー

Icon representing a data.
2022-01-09
Icon show updated_at
2022-01-09
0
Twitter icon.
Mac
AWS
aws-cli

Precondition

AWSのApp Runnerを使用する際、DockerのimageをAmazon ECRへプッシュする必要があった。
aws-cliのversionは2.0.30

Fact

Amazon ECRのpublicリポジトリへdocker imageをpushしようとした際、下記コマンドを打った時に出たエラー
aws ecr-public get-login-password --region <region> | docker login --username AWS --password-stdin public.ecr.aws/<id>

Error log or Error Massage

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: argument command: Invalid choice, valid choices are:

accessanalyzer                           | acm                                     
acm-pca                                  | alexaforbusiness                        
amplify                                  | apigateway                              
apigatewaymanagementapi                  | apigatewayv2                            
appconfig                                | application-autoscaling                 
application-insights                     | appmesh                                 
appstream                                | appsync                                 
athena                                   | autoscaling                             
autoscaling-plans                        | backup                                  
batch                                    | budgets                                 
ce                                       | chime                                   
cloud9                                   | clouddirectory                          
cloudformation                           | cloudfront                              
cloudhsm                                 | cloudhsmv2                              
cloudsearch                              | cloudsearchdomain                       
cloudtrail                               | cloudwatch                              
codeartifact                             | codebuild                               
codecommit                               | codeguru-reviewer                       
codeguruprofiler                         | codepipeline                            
codestar                                 | codestar-connections                    
codestar-notifications                   | cognito-identity                        
cognito-idp                              | cognito-sync                            
comprehend                               | comprehendmedical                       
compute-optimizer                        | connect                                 
connectparticipant                       | cur                                     
dataexchange                             | datapipeline                            
datasync                                 | dax                                     
detective                                | devicefarm                              
directconnect                            | discovery                               
dlm                                      | dms                                     
docdb                                    | ds                                      
dynamodb                                 | dynamodbstreams                         
ebs                                      | ec2                                     
ec2-instance-connect                     | ecr                                     
ecs                                      | efs                                     
eks                                      | elastic-inference                       
elasticache                              | elasticbeanstalk                        
elastictranscoder                        | elb                                     
elbv2                                    | emr                                     
es                                       | events                                  
firehose                                 | fms                                     

..........(略).........         

workdocs                                 | worklink                                
workmail                                 | workmailmessageflow                     
workspaces                               | xray                                    
s3api                                    | s3                                      
ddb                                      | configure                               
deploy                                   | configservice                           
opsworks-cm                              | history                                 
cli-dev                                  | help                                    
Error: Cannot perform an interactive login from a non TTY device

Cause

aws cliが最新でなかったのが原因

Method

インストールした時と同じ方法で、インストールしなおしたら解決した。
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

最新版は2.4.9(2022/01時点)

Remarks

Amazon ECRはリポジトリがprivateとpublicとで、打つコマンドが異なるので注意

レベル5のエンジニアです
Area to place ads.
Area to place ads.
Comments
There are no comments on this article yet.

Environment Library tools

Mac
AWS
aws-cli
レベル5のエンジニアです