129

I just updated my docker version and found out that command

aws ecr get-login

is not working anymore. Got error:

unknown shorthand flag: 'e' in -e`. Seems that docker doesn't support -e flag anymore.

Is there a way to fix this?

Installed versions:

aws-cli/1.11.111 Python/2.7.10 Darwin/16.6.0 botocore/1.5.74

Docker version 17.06.0-ce-rc5, build b7e4173
jtoberon
  • 8,706
  • 1
  • 35
  • 48
Chris
  • 3,795
  • 3
  • 17
  • 23
  • 1
    And this is why we don't use the short options in our interfaces, scripts, and anything else that might ever cross the eyes of users who don't perfectly remember every command-line option of the tools being used. It might be off-topic, but I think it is important to emphasize, because every software developer who comes across questions like this needs to make this connection, and too many won't. (Because if the option being passed to docker was something like `--email`, it would decrease the effort and increase the odds of users discovering `--no-include-email` on their own.) – mtraceur Nov 05 '19 at 00:24

6 Answers6

211

add this to your call

--no-include-email

here is the new valid syntax :

aws ecr get-login   ${normal_params_here}   --no-include-email
aws ecr get-login   --region us-east-1      --no-include-email  # for example

This new option is available in AWS CLI as of version 1.11.91 released on 05/23/2017 ... issue this to upgrade :

pip install --upgrade awscli

see details here

https://github.com/docker/for-mac/issues/1762

https://github.com/aws/aws-cli/issues/1926

to quote :

"You should have received an email notification from Amazon around May 23 2017 about the new --no-include-email flag on aws ecr get-login for compatibility with [Docker] 17.06.0"

For example after I issue following

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

it shows me following output

docker login -u AWS -p foobarZUFtSzg4SDBUa0lDSEpTNUQ5M3pDVDhHNi9jS2s3SExhQWpheEVMWTlmY0pNWlphOEN5M2hJTUFoMDlJczd0anVoRk9CKzE1ODdBdmQ1ZzRNR3pKa1lMZ2NTOGo4Mk1sZGlwdDRjQlJyOERvaDFiaEt6TWRlVHkzalA2Um5RSTBNNW5qRW9WL1ZlaEhxMTV4bjl5aXQrV1NXMnp1NWNwek1JQWVxRjd0YWhZWkxxYmdRVjdldE9LQUY3dW5OWFFSM20vY0x4L1ZKWW9BZzlNM0wrQy8vdENEQXRXMFpvTTNrVXNxTHg4MEFQQXJRV08yZ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JCd0V3SGdZSllJWklBV1VEQkFFdU1CRUVESnpKWXZhbXBFRkFSVUx5bUFJQkVJQTcwZk1ZUlU4bG9RVnRwMWJJUHRoZktTOFMzZVpZNS8rT0orL0RmSjZXNVpiK0p0TURXZmZ5Rm9vc0gzMDFVWS9OQ1lzb2hWM1FER2E3NmZ3PSIsInZlcnNpb24iOiIyIiwidHlwZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTU2NDkxNTYyOH0= https://092412696969.dkr.ecr.us-east-1.amazonaws.com

so to complete docker login to aws repository copy N paste above back into same terminal, as per ...

 docker login -u AWS -p foobarZUFtSzg4SDBUa0lDSEpTNUQ5M3pDVDhHNi9jS2s3SExhQWpheEVMWTlmY0pNWlphOEN5M2hJTUFoMDlJczd0anVoRk9CKzE1ODdBdmQ1ZzRNR3pKa1lMZ2NTOGo4Mk1sZGlwdDRjQlJyOERvaDFiaEt6TWRlVHkzalA2Um5RSTBNNW5qRW9WL1ZlaEhxMTV4bjl5aXQrV1NXMnp1NWNwek1JQWVxRjd0YWhZWkxxYmdRVjdldE9LQUY3dW5OWFFSM20vY0x4L1ZKWW9BZzlNM0wrQy8vdENEQXRXMFpvTTNrVXNxTHg4MEFQQXJRV08yZ1BRb0VLcHo1ZE1sc1JLS25hWit2eGVzODdlUFZ3OS9tT29BV0pEUzBSWUx0ellsUUVKNUpadXlkbXlnL2owL2N5VUJaSWNpajJaVExrYTlwRm9STkVhejVZKzhBU3N4S1c4RWNIOThuNi8xcDRDU09lcnlQUjUwYnRGZ1RtWk5LNVRTaW92ZXhNYUs2RFpLTU83MHgvYlpRcXgxYWh5U2FFTXR5RlMxempqVlFva3JVeTYrQVMwL09pQ2NRV1o2S01kMDc5akNDdE5YakFzamNsUTUzZVE4TUFUTWIrYTBBNFlIaDJNcFJ2RjU5dWNHS2tYUkl4WGNVY1Zpc2l4NmJNaEo4dEZsK0hEem5PSXRHRmh3b3lZV093OEw3dFlwbFFTSEFTaVdsemRSVTNvQmREQ2FCZys3R09BUW96SWxsWnV2Yk51cG1qWkFzMWE5MzdMelQ0Y25lemYwbWZUSFBDVVpzYzQ2Wk1jWkl4MjMrU0lpL3g3aFZ1NXJzcklVVFJTd1UwRUpLbFNIUkZKZ0xqZ0R1bnVrSGlrY0pnZEhseDlKRmloWEM3REF6bDByMkc4LzN1SG4xeEFCdWVlN2tUU2dsS0lTcW45ejI3eUlCc3BjOUhxU2JuUzNTOGVJamJvdmdaQWNNL1R2YUVTTEdsM0hrUnlXb04zUVhFM2NWa1poR1ZDZEJCTlRiekkvMUlLVENnNnlKNTVibThMTE0rcEdFQ1h1M1JwWWZUU3VLOVc0NytQVkJUSWtsNnhrd0Jobm9nZ1MwUkYyc2xNb1F6S08zZHhva24zN0dSS1hoOXhSbG85RVlWOHZLRzVzbjdhbnhpby9EL3ZDbHFXWTlLRGVwOGxMK0NhR3lpbDRHZ3JwWmtWampaaExzQ1cyTWk0L3NXUTEyV0ZCR0JnOSIsImRhdGFrZXkiOiJBUUVCQUhod20wWWFJU0plUnRKbTVuMUc2dXFlZWtYdW9YWFBlNVVGY2U5UnE4LzE0d0FBQUg0d2ZBWUpLb1pJaHZjTkFRY0dvRzh3YlFJQkFEQm9CZ2txaGtpRzl3MEJCd0V3SGdZSllJWklBV1VEQkFFdU1CRUVESnpKWXZhbXBFRkFSVUx5bUFJQkVJQTcwZk1ZUlU4bG9RVnRwMWJJUHRoZktTOFMzZVpZNS8rT0orL0RmSjZXNVpiK0p0TURXZmZ5Rm9vc0gzMDFVWS9OQ1lzb2hWM1FER2E3NmZ3PSIsInZlcnNpb24iOiIyIiwidHlwZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTU2NDkxNTYyOH0= https://092412696969.dkr.ecr.us-east-1.amazonaws.com
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /home/pualu/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

now you are logged into the aws docker repository

Scott Stensland
  • 26,870
  • 12
  • 93
  • 104
  • 4
    Note that this may require updating `aws` cli to most recent version. – broofa Jul 05 '17 at 21:01
  • 3
    sudo pip install --upgrade awscli – Phil Strong Jul 10 '17 at 15:25
  • Is the instruction from `docker push` also outdated? It doesn't mention the `--no-include-email` flag and just says "denied: Your Authorization Token has expired. Please run 'aws ecr get-login' to fetch a new one." – dcorking Nov 27 '17 at 10:53
  • 1
    For some reason running `pip install --upgrade awscli` doesn't update aws and the `--no-include-email` options is not recognized. I had to use the answer from amazia down below – Jonathan Morales Vélez Mar 14 '18 at 21:18
18

if for some reason you can't upgrade awscli version, you can do a little string manipulation to make it work for you with sed.

for example:

$(aws ecr get-login --region eu-central-1 | sed -e 's/-e none//g')

this will drop the -e flag that is not supported and you should be able to login.

Amazia Gur
  • 1,692
  • 17
  • 16
7

I had the same issue however following Scott Stensland's answer did not solve it.

In case it will happen to someone else, dropping '-e none' from the command solved the issue.

Asafm
  • 177
  • 1
  • 13
  • The answer you reference suggests adding `--no-include-email` to the `ecr login` command. The effect of this is precisely to drop `-e none` from the `docker login` command that it outputs. – dsclose Nov 19 '19 at 18:58
1

Run login statement.

aws ecr get-login --region us-west-2

Then, remove the flag and value -e none from the resulting statement. So, what you run would look like...

docker login -u AWS -p <long password hash> https://<image ID>.dkr.ecr.us-west-2.amazonaws.com 
openwonk
  • 14,023
  • 7
  • 43
  • 39
  • 1
    Adding `--no-include-email` to the `ecr get-login` command omits the `-e none` from from the output. – dsclose Nov 19 '19 at 18:59
1

If you prefer to avoid refreshing your authentication token manually with aws ecr get-login, you can install the Amazon ECR credential helper instead. The credential helper will take care of retrieving and updating tokens automatically so you don't need to refresh it yourself. Packages are available for Debian (Buster or newer), Ubuntu (19.10 or newer), Amazon Linux 2, Mac OS (via Homebrew), and a few other operating systems, or you can download binary releases from the releases page.

Samuel Karp
  • 4,373
  • 22
  • 34
-1
C:\WINDOWS\system32>docker rm -f $(docker ps -qa)
unknown shorthand flag: 'q' in -qa)
See 'docker rm --help'.

If the issue is caused in Windows OS then try to run the command in PowerShell with Admin Privileges

It worked for me.

Hector Vido
  • 765
  • 5
  • 12