|
|
Container Registry
Author: Venkata Sudhakar
Google Container Registry (GCR) is a private Docker image registry hosted on Google Cloud Platform. It allows teams to store, manage, and secure Docker container images in a fully managed service that integrates natively with GCP services such as GKE, Cloud Run, and Cloud Build. Container Registry stores images in Google Cloud Storage buckets, giving you fine-grained access control using GCP IAM roles - no separate credentials or registry accounts are needed. Images are stored regionally (us, eu, asia) or in specific regions (us-central1, europe-west1) to reduce latency and egress costs. GCR is being gradually succeeded by Artifact Registry, which supports additional formats beyond Docker images such as Maven, npm, and Python packages. The below example shows how to authenticate with Container Registry, push a Docker image, and pull it back using the gcloud and docker CLI tools.
It gives the following output,
Adding credentials for all GCR repositories.
Docker configuration file updated.
v1.0: digest: sha256:abc123... size: 1234
Pushing gcr.io/my-project/my-app:v1.0
Layer 1/5: Pushed
Layer 2/5: Pushed
Layer 3/5: Pushed
Layer 4/5: Pushed
Layer 5/5: Pushed
v1.0: digest: sha256:abc123def456 size: 52428800
The below example shows how to list images in Container Registry and manage image tags using gcloud commands.
It gives the following output,
NAME
gcr.io/my-project/my-app
gcr.io/my-project/api-service
DIGEST TAGS TIMESTAMP
abc123def456 v1.0 2024-01-15T10:30:00
789xyz101112 v0.9 2024-01-10T08:00:00
Digest of gcr.io/my-project/my-app:latest: sha256:abc123def456
Tagged [gcr.io/my-project/my-app:latest]
Container Registry vs Artifact Registry: Google recommends migrating to Artifact Registry, which is the next generation of Container Registry. Artifact Registry supports Docker images, Maven packages, npm packages, Python packages, and more. It provides stronger IAM controls, VPC Service Controls support, and regional repositories. The gcr.io hostname continues to work and routes to Artifact Registry automatically in projects where Artifact Registry is enabled.
|
|