Aws-cli: aws ecr get-login broken in latest rc build

Created on 21 Jun 2017  路  29Comments  路  Source: aws/aws-cli

$ `aws ecr get-login`
unknown shorthand flag: 'e' in -e
See 'docker login --help'.

$ docker --version
Docker version 17.06.0-ce-rc4, build 29fcd5d
closing-soon guidance

Most helpful comment

Hopefully this helps someone, as my aws --version was not changing (Ubuntu 16.04).

Managed to resolve by using pip3 instead:

pip3 install --upgrade awscli

This may require you to install

apt-get install python3-pip
Before pip3
aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-1038-aws botocore/1.4.70

After pip3
aws-cli/1.14.2 Python/3.5.2 Linux/4.4.0-1041-aws botocore/1.8.6

All 29 comments

You will need to supply the --no-include-email flag

Also, please see this forum post for more context about this https://forums.aws.amazon.com/ann.jspa?annID=4656

Why is this marked as "closing-soon-if-no-response"? The aws commandline tool is generating an incorrect docker login command, so this seems like a bug with aws, not a question.

You will need to supply the --no-email flag

The flag is --no-include-email, not --no-email.

@ottumm We can't change our current behavior or we'll break customers locked to older versions of docker. The compromise is to have the flag which will allow customers who upgrade to unblock themselves.

Rather than adding a flag why not detect the docker version. It seems that the AWS client has enough information to decide whether or not to include the -e in the login command rather than generating an invalid command.

Absolutely agree with @Clecompt. There are environments (e.g. Travis) where the Docker version is not under the user's control. Detecting the Docker version and emitting the appropriate command seems like the right thing to do here.

Because detecting the docker version and testing that on every possible system configuration people are using in the CLI in is not feasible and very brittle even if we could get it to work. Even if we could get this to work that makes the assumption that the login command is being run on the same machine in the environment where we detected the docker version. People have very complicated build systems spread out over multiple machines/images/environments so that is not an acceptable assumption to make.

You can control the docker version in travis by the way using the before_install key.

@stealthycoin Has this issue been fixed?

Agreed that detecting the docker version is no good.

The email option has been removed from Docker so having some sort of --no-include-email flag is required.

@JordonPhillips I am adding --no-include-email it gives me Unknown Options. According aws docs, Updated to latest version still I get the same Unknown Options.

@vanaparth had the same issue, updating aws cli tools with sudo pip install --upgrade awscli fixed the problem

I tried the command which you mentioned still getting the same problem. Is there any other way we can clear this issue. @igarcez

@igarcez Here is the other way to login. I have a workaround
sudo docker login -u AWS -p $(aws ecr get-authorization-token --output text --query authorizationData[].authorizationToken | base64 -d | cut -d: -f2) ${ECR_URL}.

Still broken. Installed the latest version of AWS CLI.
Running this command:

aws ecr get-login --region <my-region> --no-include-email

returns

Unknown options: --no-include-email

Still an issue!

aws ecr get-login --region us-west-2 --no-include-email

yields:

Unknown options: --no-include-email

$ aws --version

aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-1022-aws botocore/1.4.70

@sfertman @zeg-io you're not using the latest. i'm on 1.11.120 and the following works for me

aws ecr get-login --region us-east-2 --no-include-email

looks like it was added in 1.11.91: https://github.com/aws/aws-cli/commit/4b3e8d0b21532d8a0e29c3a817978ca7f213d501

@zeg-io you are actually using version 1.11.130 (aws-cli/1.11.13), I just downgraded to 1.11.120 and it works ok

@mmas why do you say he's using version 1.11.130 when it says aws-cli/1.11.13? I'm running 1.11.120 and it doesn't get truncated when I run --version, it shows aws-cli/1.11.120.

@bbakersmith I had version 1.11.130 (checked with pip) and it was showing truncated for me with awscli --version

@mmas odd. it doesn't for me. I just upgraded and get aws-cli/1.11.130 as expected.

And the --no-include-email flag does work in 1.11.130 for me.

aws-cli/1.11.42 Python/2.7.10 Darwin/16.7.0 botocore/1.5.5
I've got still "Unknown options: --no-include-email"

@ChrisRyuGS You need to upgrade. As I said a few comments up, it was added in 1.11.91
https://github.com/aws/aws-cli/issues/2676#issuecomment-320051215

@bbakersmith Thank you.
It was python version problem.

Hopefully this helps someone, as my aws --version was not changing (Ubuntu 16.04).

Managed to resolve by using pip3 instead:

pip3 install --upgrade awscli

This may require you to install

apt-get install python3-pip
Before pip3
aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-1038-aws botocore/1.4.70

After pip3
aws-cli/1.14.2 Python/3.5.2 Linux/4.4.0-1041-aws botocore/1.8.6

For people coming from Google stuck here on old environments, there's an easy solution :

eval $(aws ecr get-login --region eu-west-1 | sed 's/ \-e none//')

Mine is strange, I got this error

screen shot 2018-10-08 at 9 37 12 pm

and guess what? I use amazon image

screen shot 2018-10-08 at 9 48 08 pm

This is my buildspec.yml

version: 0.2

phases:
  install:
    commands:
      - $(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)
  build:
    commands:
      - echo Build started on `date`
      - echo Building the Docker image...
      - docker build -t timesheet-cakephp:latest .
      - docker tag timesheet-cakephp:latest 502776083946.dkr.ecr.ap-southeast-1.amazonaws.com/timesheet-cakephp
  post_build:
    commands:
      - echo Build completed on `date`
      - echo Pushing the Docker image...
      - docker push 502776083946.dkr.ecr.ap-southeast-1.amazonaws.com/timesheet-cakephp

The workaround for aws docker login error I use.

  • Run aws ecr get-login
  • Run the output of get-login. (Remove the flag -e none in the comand). Look for successful login output.
  • Run cat ~/.docker/config.json to verify.

This status code usually indicates an unauthorized user. To fix this, we need to let our Code Build role be able to talk to ECR. To do this: Go to IAM and then attach a AmazonEC2ContainerRegistryPowerUser policy to your CodeBuild role.

Was this page helpful?
0 / 5 - 0 ratings