docker login: error storing credentials `The stub received bad data.`

PangSoramDepo picture PangSoramDepo · Mar 23, 2020 · Viewed 7.5k times · Source

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

Answer

sashoalm picture sashoalm · Aug 5, 2020

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