Skip to content

How to Fix 'docker login' Issues

DodaTech 2 min read

In this tutorial, you'll learn about How to Fix 'docker login' Issues. We cover key concepts, practical examples, and best practices.

The Problem

You run docker login and get Error: docker-credential-helpers not configured or error: getting credentials - err: exit status 1. Docker cannot store or retrieve registry credentials due to missing or misconfigured credential helpers. This also happens when Docker is installed via a package manager that doesn't include the credential helpers, or when upgrading from an older Docker version where the config references a helper binary that no longer exists.

The error prevents you from pulling private images or pushing images to Docker Hub, GitHub Container Registry, AWS ECR, or any private registry. Without fixing the credential helper, automated deployments and CI/CD pipelines that rely on Docker login will fail.

Quick Fix

1. Check your Docker config file

cat ~/.docker/config.json

Look for a credsStore field. If present, it points to a credential helper that may not be installed.

Expected output if credsStore is set:

{
  "auths": {},
  "credsStore": "desktop"
}

The credsStore value could be desktop, osxkeychain, wincred, pass, or secretservice. If the corresponding helper binary is missing from your system, Docker cannot read or write credentials.

2. Remove the credsStore to use plain file storage

# Edit config.json and either remove the credsStore line or set it to empty
sed -i 's/"credsStore":.*//' ~/.docker/config.json

# Or rewrite the file with only the auths section
echo '{"auths":{}}' > ~/.docker/config.json

This tells Docker to store credentials in the config file directly instead of using an external helper. The credentials are base64-encoded, which is less secure than a system keychain but works universally without additional dependencies.

3. Login again

docker login

Enter your Docker Hub username and password when prompted. You should see:

Login Succeeded

Credentials are now stored in ~/.docker/config.json as a base64-encoded auth string. Verify with:

cat ~/.docker/config.json | python3 -c "import sys,json; print(json.load(sys.stdin)['auths'])"

4. Login to a private registry

docker login my-registry.example.com

Enter your registry credentials. Each registry gets its own entry in the config file.

5. Install the credential helper (optional, for better security)

# On Ubuntu/Debian
sudo apt-get install docker-credential-helpers

# On macOS (via Homebrew)
brew install docker-credential-helper

# On Arch Linux
sudo pacman -S docker-credential-secretservice

After installing, update your config to use the helper:

docker-credential-secretservice list  # Verify it works

Then set credsStore to secretservice (Linux) or osxkeychain (macOS) in ~/.docker/config.json.

Prevention

  • Install docker-credential-helpers on first Docker setup to avoid the error outright
  • Use docker login with --password-stdin in CI scripts instead of storing tokens in files:
    echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
    
  • Never commit ~/.docker/config.json to version control — it contains credentials
  • Use docker logout on shared machines to clear stored credentials after use
  • When upgrading Docker, check if your config references an old credential helper by running docker login immediately after the upgrade

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro