cicd authentication ai_generated true

Error: Username and password required. Error: Process completed with exit code 1.

ID: cicd/gha-docker-login-failed

Also available as: JSON · Markdown
90%Fix Rate
89%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
any active

Root Cause

Docker login fails in GitHub Actions when pushing images to a container registry. Usually caused by missing or incorrect registry credentials, expired tokens, or wrong registry URL.

generic

Workarounds

  1. 93% success Use docker/login-action with proper registry credentials stored as secrets
    Add 'uses: docker/login-action@v3' with 'registry: ghcr.io' (or your registry), 'username: ${{ github.actor }}', and 'password: ${{ secrets.GITHUB_TOKEN }}' for ghcr.io, or appropriate secrets for other registries
  2. 91% success Use GITHUB_TOKEN for GitHub Container Registry authentication
    For ghcr.io, set 'permissions: packages: write' in the workflow and use 'password: ${{ secrets.GITHUB_TOKEN }}' with 'registry: ghcr.io'

Dead Ends

Common approaches that don't work:

  1. Use docker login with plaintext password in a run step 70% fail

    Password appears in workflow logs even with masking; insecure and often fails due to stdin issues in CI

  2. Assume GITHUB_TOKEN works for Docker Hub pushes 95% fail

    GITHUB_TOKEN only authenticates to ghcr.io (GitHub Container Registry), not Docker Hub or other registries

Error Chain

Leads to:
Preceded by:
Frequently confused with: