Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trying to login to ECR fails with -no-include-email error

I am using this command to login to docker on my EC2

$(aws ecr get-login --registry-ids xxxxxxx --region us-west-1 --no-include-email)

when I do that, I get following error:

Unknown options: --no-include-email

what am I missing?

like image 995
Lost Avatar asked Oct 19 '17 17:10

Lost


People also ask

How do I authenticate to ECR?

To authenticate Docker to an Amazon ECR registry with get-login-password, run the aws ecr get-login-password command. When passing the authentication token to the docker login command, use the value AWS for the username and specify the Amazon ECR registry URI you want to authenticate to.

How do I find my ECR URL?

The URL for your default private registry is https:// aws_account_id . dkr. ecr.

How long does ECR token last?

An authorization token represents your IAM authentication credentials and can be used to access any Amazon ECR registry that your IAM principal has access to. The authorization token is valid for 12 hours.


2 Answers

Above description is correct, steps are here:

  1. sudo apt install awscli
  2. sudo apt-get install python3-pip
  3. sudo pip3 install --upgrade awscli

Reference: https://github.com/aws/aws-cli/issues/2676

like image 153
Abhinav Avatar answered Oct 05 '22 13:10

Abhinav


The answer is already given, but it does not work aws-cli v2, so posting as an answer may help other

$(aws ecr get-login --no-include-email --region us-west-2)
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 operation: Invalid choice, valid choices are:

To get login token with aws-cli V2 you can try

aws ecr get-login-password | docker login --username AWS --password-stdin 1234567890.dkr.ecr.us-west-2.amazonaws.com/reponame

To install AWS-CLI V2 you can check here

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
like image 32
Adiii Avatar answered Oct 05 '22 14:10

Adiii