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

docker login: error storing credentials `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. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin 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. Seehttps://docs.docker.com/engine/reference/commandline/login/#credentials-storeLogin Succeeded
  • Tickets opened to address this issue-

https://github.com/danieljoos/wincred/issues/18

https://github.com/aws/aws-cli/issues/5636


As @Ethan Davis mentioned, removing the following files helped me:

  • C:\Program Files\Docker\Docker\resources\bin\docker-credential-desktop.exe
  • C:\Program Files\Docker\Docker\resources\bin\docker-credential-wincred.exe