docker, aws,

How to fix Docker login unknown shorthand flag error

Jul 03, 2021 · 1 min read · Post a comment
How to fix Docker login unknown shorthand flag error

In some of the previous posts I’ve covered the Authorization token method when authenticating to an AWS ECR private registry. If you have followed the steps as described in the post you won’t get any errors unless you try to go with aws ecr get-login command instead of aws ecr get-login-password. So, if you try to run the output from aws ecr get-login, you’ll get the following error:

unknown shorthand flag: 'e' in -e
See 'docker login --help'.

Prerequisites

  • AWS CLI
  • Docker

Solution

Step 1. The updated command is basically the same as aws ecr get-login output, but without the -e flag. Something like:

docker login -u AWS -p <some_secret_string> https://aws_account_id.dkr.ecr.region.amazonaws.com

Output:

WARNING! Using --password via the CLI is insecure. Use --password-stdin.
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store

Login Succeeded

Conclusion

The reason for seeing this error is that in 17.0.6 Docker engine update, the -e and --email flags were deprecated. Check it out for yourself Deprecated Engine Features.
Back in 2017, AWS came up with an announcement as well Announcement: Docker Email Flag Removal.
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.