Skip to content
Latchkey

gcloud auth configure-docker: Push Images in CI

Register gcloud as a Docker credential helper so docker push works against Artifact Registry or GCR.

gcloud auth configure-docker writes a credential helper entry into ~/.docker/config.json so the Docker CLI can authenticate to Google registries using your active gcloud credentials. In CI you run it once after authenticating, then docker push and docker pull just work.

Common flags

  • REGISTRIES - comma-separated hosts, e.g. us-docker.pkg.dev (positional)
  • --quiet - skip the interactive confirmation prompt (needed in CI)

Example in CI

Configure the helper for an Artifact Registry region, then push.

shell
gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
docker push us-central1-docker.pkg.dev/my-project/my-repo/app:${GITHUB_SHA}

Common errors in CI

  • denied: Permission "artifactregistry.repositories.uploadArtifacts" denied - SA missing Artifact Registry Writer
  • unauthorized: authentication failed - configure-docker not run, or wrong registry host
  • gcloud crashed ... config.json - the docker config dir is unwritable on the runner

Key takeaways

  • Registers gcloud as a Docker credential helper for Google registries.
  • Pass the exact registry host (region-aware for Artifact Registry) and --quiet in CI.
  • Push failures are usually missing IAM roles, not a configure-docker bug.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →