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
gcloud auth activate-service-account: Authenticate CIAuthenticate gcloud in CI with a service account key file: required flags, a GitHub Actions example, and the…
gcloud run deploy: Ship to Cloud Run in CIDeploy a container or source to Cloud Run from a pipeline: the flags you need, a CI example, and the deploy e…
gcloud builds submit: Build with Cloud Build in CISubmit a build to Cloud Build from CI: key flags for tag and config, a pipeline example, and the build errors…