docker login unknown shorthand flag: 'e'

DockerAws Ecr

Docker Problem Overview


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

Docker Solutions


Solution 1 - Docker

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 foobarZUFtSzg4SDBUa0lDSEpTNUQ5M3pDVDhHNi9jS2s3SExhQWpheEVMWTlmY0pNWlphOEN5M2hJTUFoMDlJczd0anVoRk9CKzE1ODdBdmQ1ZzRNR3pKa1lMZ2NTOGo4Mk1sZGlwdDRjQlJyOERvaDFiaEt6TWRlVHkzalA2Um5RSTBNNW5qRW9WL1ZlaEhxMTV4bjl5aXQrV1NXMnp1NWNwek1JQWVxRjd0YWhZWkxxYmdRVjdldE9LQUY3dW5OWFFSM20vY0x4L1ZKWW9BZzlNM0wrQy8vdENEQXRXMFpvTTNrVXNxTHg4MEFQQXJRV08yZ1BRb0VLcHo1ZE1sc1JLS25hWit2eGVzODdlUFZ3OS9tT29BV0pEUzBSWUx0ellsUUVKNUpadXlkbXlnL2owL2N5VUJaSWNpajJaVExrYTlwRm9STkVhejVZKzhBU3N4S1c4RWNIOThuNi8xcDRDU09lcnlQUjUwYnRGZ1RtWk5LNVRTaW92ZXhNYUs2RFpLTU83MHgvYlpR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wZSI6IkRBVEFfS0VZIiwiZXhwaXJhdGlvbiI6MTU2NDkxNTYyOH0= 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

Solution 2 - Docker

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.

Solution 3 - Docker

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.

Solution 4 - Docker

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 

Solution 5 - Docker

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.

Solution 6 - Docker

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.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionChrisView Question on Stackoverflow
Solution 1 - DockerScott StenslandView Answer on Stackoverflow
Solution 2 - DockeramaziaView Answer on Stackoverflow
Solution 3 - DockerAsafmView Answer on Stackoverflow
Solution 4 - DockeropenwonkView Answer on Stackoverflow
Solution 5 - DockerSamuel KarpView Answer on Stackoverflow
Solution 6 - Dockeruser2817844View Answer on Stackoverflow