Answers: <p>I hope you have logged in with the IAM user with the AdministratorAccess policy using the <code>aws configure</code> command.</p>
  <p>One quick workaround is to modify <code>.docker\config.json</code> file. Remove the following line &quot;credsStore&quot; key so that the docker will use the file system to store tokens:</p>
  <pre><code>      &quot;credsStore&quot;: &quot;wincred&quot;
  </code></pre>
  <p>Now run your AWS CLI command:</p>
  <pre><code>aws ecr-public get-login-password --region us-east-1 | docker login --username 
  AWS --password-stdin public.ecr.aws/.....
  </code></pre>
  <p>And you should get the output like this:</p>
  <pre><code>WARNING! Your password will be stored unencrypted in C:\Users\user\.docker\config.json.
  Configure a credential helper to remove this warning. See
  https://docs.docker.com/engine/reference/commandline/login/#credentials-store
  
  Login Succeeded
  </code></pre>
  <p>Also, I think that removing <code>C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe</code> and <code>C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe</code> might work.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-04-23T04:05:30.643Z
Answers: 2024-04-25T03:10:22.353Z
Answers: 2024-04-25T03:10:22.353Z
Answers: Ajay
Body: <p>I am trying to push my Nest.js app to an AWS ECR in a public repo. I created an IAM user and attached AdminstratorAccess policy to it and then generated a private key.   When I type the following command in cmd:</p>
  <pre><code>aws ecr-public get-login-password --region us-east-1 | docker login --username 
  AWS --password-stdin public.ecr.aws/.....
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `The stub received bad data.``
  </code></pre>
  <p>I have AWS CLI installed.</p>
  
Tags: <docker><aws-cli><aws-ecr>
Title: AWS ECR Public gives error in CLI
UserDisplayName: Ahmad Qayyum
ThreadText: # AWS ECR Public gives error in CLI
  
  (Asked by: username_0 on 2024-04-22)
  
  I am trying to push my Nest.js app to an AWS ECR in a public repo. I created an IAM user and attached AdminstratorAccess policy to it and then generated a private key. When I type the following command in cmd:
  
  ```
  aws ecr-public get-login-password --region us-east-1 | docker login --username 
  AWS --password-stdin public.ecr.aws/.....
  
  ```
  
  I get the following error:
  
  ```
  Error saving credentials: error storing credentials - err: exit status 1, out: `error storing credentials - err: exit status 1, out: `The stub received bad data.``
  
  ```
  
  I have AWS CLI installed.
  
  **Tags:** docker, aws-cli, aws-ecr
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-04-23. Score: 0
  
  I hope you have logged in with the IAM user with the AdministratorAccess policy using the `aws configure` command.
  
  One quick workaround is to modify `.docker\config.json` file. Remove the following line "credsStore" key so that the docker will use the file system to store tokens:
  
  ```
        "credsStore": "wincred"
  
  ```
  
  Now run your AWS CLI command:
  
  ```
  aws ecr-public get-login-password --region us-east-1 | docker login --username 
  AWS --password-stdin public.ecr.aws/.....
  
  ```
  
  And you should get the output like this:
  
  ```
  WARNING! Your password will be stored unencrypted in C:\Users\user\.docker\config.json.
  Configure a credential helper to remove this warning. See
  https://docs.docker.com/engine/reference/commandline/login/#credentials-store
  
  Login Succeeded
  
  ```
  
  Also, I think that removing `C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe` and `C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe` might work.
  
  
  ---
  
  