Course contentsShow
← Cloud and Infrastructure
Lesson 1096 of 2,98921. Container RegistriesFree lesson

GCP Registry Authentication and IAM

Configure authentication for Google registries using service accounts and IAM permissions.

GCP Registry Authentication and IAM

What you'll learn: How to securely connect to Google's container registries using service accounts and IAM permissions.

The Core Idea

When you push or pull images to Google Container Registry (GCR) or Artifact Registry, Google needs to verify you have permission. GCP uses service accounts (special Google Cloud identities for applications) combined with IAM roles to control who can read, write, or manage container images.

Think of it like a building's security system: your service account is your ID badge, and IAM roles are the access levels determining which floors and rooms you can enter.

How Authentication Works

GCP registries authenticate using OAuth 2.0 tokens tied to service accounts. When Docker communicates with GCR or Artifact Registry, it presents these credentials automatically.

Key authentication methods:

  1. gcloud credential helper - Automatically uses your local gcloud CLI credentials
  2. Service account key files - JSON keys for programmatic access (CI/CD pipelines)
  3. Workload Identity - For applications running on GKE clusters

IAM Roles for Registry Access

Common predefined roles:

  • roles/artifactregistry.reader - Pull images only
  • roles/artifactregistry.writer - Pull and push images
  • roles/artifactregistry.admin - Full repository management

You grant these roles to service accounts or users at the project or repository level, following the principle of least privilege—give only the minimum access needed.

Practical Flow

A CI/CD pipeline typically uses a service account with writer permissions: authenticate with the JSON key, run docker push, and the IAM policy allows the upload. Production clusters use separate service accounts with reader permissions to pull images for deployment.

Key Takeaway: GCP registry authentication combines service accounts (who you are) with IAM roles (what you can do) to provide granular, secure access control for container images.