Docker login "error storing credentials: The stub received bad data" on Windows
Codemia Knowledge Hub ·
The docker login error "error saving credentials: error storing credentials ... The stub received bad data." means Docker failed while storing your credentials in the native credential store, usually the Windows Credential Manager. To fix it, check the credential store settings in ~/.docker/config.json, remove Docker's entries from Windows Credential Manager, and log in again. If that fails, update or reinstall Docker Desktop.
Why the stub receives bad data
The error mostly appears on Windows. Depending on setup, Docker hands credentials to the native Windows credential store, and a failure or miscommunication in that Windows API call produces this message.
- Credential storage backend: Docker saves credentials through credential stores or keychains. On Windows it may talk to the Windows Credential Manager, and this error usually means that interaction failed, possibly because of corrupted data or misconfiguration.
- Windows API: Windows uses several APIs to handle credential data securely. The error suggests one of them received data it considered invalid, hence the "bad data" stub.
- Docker configuration: misconfigured credential storage settings can cause it too. For example, an incorrect path to the native store stops Docker from reading or writing credentials properly.
Fixing the error
- Check Docker configuration files:
- Make sure your Docker configuration does not specify or misconfigure a credential store by mistake. The file is typically
~/.docker/config.json.
- Clear Docker credentials:
- Remove Docker credentials from the Windows Credential Manager, then log in again. Open it from the Control Panel or by searching "Credential Manager" in Windows settings.
- Reinstall or update Docker Desktop:
- This repairs or updates components that may be corrupted or outdated.
- Turn on debug logs:
- Enable debug mode via
Docker Desktop -> Settings -> Daemon -> Enable Debuggingfor more context around login failures.
- Install system updates:
- Make sure Windows updates and system dependencies are installed, since compatibility issues can also cause the error.
Example: error after a Docker Desktop update
You update Docker Desktop on Windows and docker login starts failing with The stub received bad data. The credential helper configuration still points to an old version of the Docker credential helper. Updating the helper reference or reinstalling Docker fixes it.
Background worth knowing
- Docker credential helpers: Docker uses credential helpers to secure authentication data. Knowing how they work helps diagnose authentication failures.
- Windows Credential Manager: the native Windows credential manager. Understanding how it interfaces with Docker helps keep logins working.
- Linux and macOS: this specific error is Windows-centric, but Docker handles credentials differently on each platform.
Error, cause and fix at a glance
| Aspect | Key Points |
| Error Message | The stub received bad data. |
| Primary Cause | Issue with the Windows Credential Manager interacting with Docker credentials. |
| Resolution Steps | - Check Docker configuration files. - Clear credentials from Windows Credential Manager. - Reconfigure or update Docker Desktop. |
| Relevant Tools | Windows Credential Manager, Docker Desktop, Docker CLI. |
| Related Topics | Docker Credential Helpers, Windows API, Docker Configuration Files. |
Keeping the system updated helps prevent the error. If it persists, Docker's community or support can help.
Related reading
- docker login not working with nexus 3 private registry
- Docker login on ECR fails with 400 Bad Request on Powershell from Jenkins
- Docker look at the log of an exited container
- Docker Mac alternative to --nethost
- Docker Networking Disabled WARNING IPv4 forwarding is disabled. Networking will not work
- Docker nginx reverse proxy gives 502 Bad Gateway
- Docker Mount directory from one container to another
- Docker, mount volumes as readonly
System design interview problems on this topic
- Design a Container Orchestration System: solution and walkthrough
- Design a Code Deployment System: solution and walkthrough
- Design GitHub Actions: solution and walkthrough
- Design a Serverless Architecture Framework: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.