First, I installed AWS-CLI and I already used "AWS configure" to set up my secret key and I also used "Docker login" command to log in and I got success and when I typed Get-ECRLoginCommand. It works and returns the result for me.
But when I try to use the command :
(Get-ECRLoginCommand).Password | docker login --username AWS --password-stdin 837859123533.dkr.ecr.ap-east-1.amazonaws.com/spring-boot
I got an error that looks like this:
Error saving credentials: error storing credentials - err: exit status 1, out:
error storing credentials - err: exit status 1, out:The stub received bad data.``
Edit: Also see Ethan Davis's solution:
I found 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 worked for me. – Ethan Davis Sep 29 '20 at 18:10
Original: The solution linked by Joelster's comment worked for me.
One quick workaround is to modify .docker\config.json file. Remove the following line so docker will use file system to store tokens:
"credsStore": "wincred"
I opened the file c:\Users\sashoalm\.docker\config.json, and I deleted the "credsStore" key. After that this worked:
type pass.txt | docker login -u AWS --password-stdin https://123123.dkr.ecr.us-west-1.amazonaws.com
And the output was this:
WARNING! Your password will be stored unencrypted in C:\Users\sashoalm\.docker\config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
As of today's date, this issue still persists. Below are the things I discovered-
1.) This problem shows up while using SSOs for authentication. I am using Azure SSO for AWS.(https://www.npmjs.com/package/aws-azure-login)
2.) The reason is- The token returned from SSOs is long enough(more than 2550 characters) where as windows credential manager does not support such long tokens.
3.) If you use ECR credential helper (https://github.com/awslabs/amazon-ecr-credential-helper), sadly it also does not seem to work with SSOs- https://github.com/awslabs/amazon-ecr-credential-helper/issues/229
However, I followed these steps as a workaround & I'm on Windows-
1.) Remove/Rename the "docker-credential-wincred.exe" file located in "C:\Program Files\Docker\Docker\resources\bin" directory.
2.) Remove the "credStore" & "credsStore" keys from the docker config(C:\Users\PROFILE_NAME\.docker\config.json).
I get the following response-
WARNING! Your password will be stored unencrypted in C:\Users\sandeep.kumar\.docker\config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credentials-store
Login Succeeded
As @Ethan Davis mentioned, removing the following files helped me:
C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exeC:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe