Error when logging into ECR with Docker login: "Error saving credentials... not implemented"

Viewed 10536

I'm trying to log in to AWS ECR with the Docker login command. I can get a password with the AWS CLI with the command aws ecr get-login-password but when piping this into the docker login command I get the following error:

Error saving credentials: error storing credentials - err: exit status 1, out: `not implemented`

The command I am running is the one recommended in the AWS ECR documentation:

aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin account_id_redacted.dkr.ecr.us-east-1.amazonaws.com/blog-project

I'm running the latest version of AWS CLI as of this question, 2.0.57.

I'm running Docker version 2.4.0 on macOS 10.14.6

Has anyone else run into this issue, and if so have they found a solution?

I've definitely achieved this in the past, but I wonder if there is an issue between the latest versions of Docker and the AWS CLI...

5 Answers

I'm not 100% sure what the issue was here, but it was something to do with the Docker credentials helper.

I installed the Docker credentials helper for macOS, changed the credsStore parameter in ~/.docker/config.json to osxkeychain. That fixed the issues.

I had similar issue, seems like my ~/.docker/config.json was totally messed after work with multiple repos / hubs.

So I just wiped out all the content in this file leaving it empty and rerun aws ecr get-login-password | docker login ... which automatically populated config with appropriate values.

I had this issue on macOS from

.docker/config.json

remove

"credsStore" : "ecr-login"

This resolved the issue for me

if anybody has the same problem on windows then go to C:\Users folder and in the .docker folder remove the config.json file.

it might fix your problem

I believe this is the intended result (sorta). The point of using amazon-ecr-credential-helper is to not need to use docker login. You should instead configure the AWS CLI with your profile credentials (mine: myprofile). Then, you would just need to slightly modify your scripts.

For example, in ECR the AWS given steps to upload a docker image are:

  1. Retrieve an authentication token and authenticate your Docker client to your registry. Use the AWS CLI:

    aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin XXXXXXXXX.dkr.ecr.us-east-2.amazonaws.com Note: If you receive an error using the AWS CLI, make sure that you have the latest version of the AWS CLI and Docker installed.

  2. Build your Docker image using the following command. For information on building a Docker file from scratch see the instructions here . You can skip this step if your image is already built:

    docker build -t toy_project .

  3. After the build completes, tag your image so you can push the image to this repository:

    docker tag toy_project:latest XXXXXXXXX.dkr.ecr.us-east-2.amazonaws.com/toy_project:latest

  4. Run the following command to push this image to your newly created AWS repository:

    docker push XXXXXXXXX.dkr.ecr.us-east-2.amazonaws.com/toy_project:latest

However, you would want to skip step 1. The reason is that if you configured aws cli (i.e. aws configure --profile myprofile) then your credentials will be stored. So you can skip to step 2.

On the 4th step, you simply need to add AWS_PROFILE, just like below

AWS_PROFILE=myprofile docker push XXXXXXXXX.dkr.ecr.us-east-2.amazonaws.com/toy_project:latest`

With amazon-ecr-credential-helper, you no longer need to use docker login or worry about storing credentials, that is the point of amazon-ecr-credential-helper. However, this may not be the best solution for you if you need to actively use docker login in your scripts.

Note: my ~/.docker/config.json looks like

{
    "credsStore": "ecr-login"
}
Related