43

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...

1
  • 1
    I ran into the same issue. Found out that my docker-engine wasn't running locally. It was fixed as soon as I started the docker engine. Commented Mar 24, 2022 at 17:07

8 Answers 8

56

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.

2
  • 1
    This worked for me as well and I have been scouring the internet for a solution. I am using saml2aws, aws, and docker together. Once I changed my ~/.docker/config.json I ran $ aws ecr get-login-password --profile <profile_name> | docker login --username AWS --password-stdin <aws_account_id>.dkr.ecr.<region>.amazonaws.com and then $ docker push <image>
    – Jesse H.
    Commented Jun 3, 2021 at 16:14
  • 1
    This isn’t really a solution to OP. It only happens to be a solution to iOS users, but not others. If you refer to the documentation it would show you that docker login was not meant to be called with OPs configuration
    – Jon
    Commented Jun 24, 2022 at 3:50
45

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.

4
  • 1
    Note: This solution worked on a non-ios system (linux debian bullseye)
    – Julien
    Commented Sep 28, 2022 at 9:58
  • I use Mac OS as well
    – juggernaut
    Commented Oct 3, 2022 at 13:22
  • 2
    this worked for me on Ubuntu... thank you.
    – PravinY
    Commented Oct 13, 2023 at 10:04
  • Worked for me as well, note for readers: by empty he means {} and not a blank file
    – amd
    Commented Feb 22 at 13:38
12

I had this issue on macOS from

.docker/config.json

remove

"credsStore" : "ecr-login"

This resolved the issue for me

1
2

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"
}
2
  • 1
    This worked for me. I installed amazon-ecr-credential-helper, changed the ~/.docker/config.json and skipped step 1. There was no need to specify AWS_PROFILE. Commented Nov 24, 2023 at 20:38
  • AWS_PROFILE is only necessary if you have multiple accounts :)
    – Jon
    Commented Dec 28, 2023 at 20:54
1

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

0

I was able to resolve my issue by restarting my Mac. I was having issues running the docker build command, and even with restarting Docker itself, which is what prompted me to try restarting my computer.

0

In .docker/config.json I had

"credsStore": "desktop"

Changed it to

"credsStore": "osxkeychain"

Fixed the issue

-1

I was getting the same error while running this command on MacOS. Error possibly occurred because that particular location didn't have the appropriate permissions for users read/write/execute.

Also while I was doing

% docker ps

It was giving an error as: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

What I did:

% sudo chmod 777 /var/run/docker.sock

This gave all the required permissions to that location.

Hope it would help!

Not the answer you're looking for? Browse other questions tagged or ask your own question.