Google Cloud: Introduction to Artifact Registry

Share At:

Cloud Storage Options | Google Cloud

Overview

Artifact Registry provides the same container management features as Container Registry and includes additional features and benefits:Additional artifact formats

You can create repositories for the following artifact formats:

Regional repositories

Container Registry only provides multi-regional registry hosts. Artifact Registry provides both regional and multi-regional registry hosts.

Multiple, separate repositories in a single location

In Container Registry, you can only create a single registry host in a multi-region and all repositories in the registry share the same storage bucket. In Artifact Registry, each repository is a separate resource. You can apply different labels and Identity and Access Management policies to each repository.

Repository-level permissions

In Container Registry, you grant permissions for each multi-regional registry host. You cannot apply separate permissions at the repository level. Artifact Registry offers repository level access control.

Artifact Registry IAM roles

In Container Registry you use Cloud Storage roles to control access and need to push an image to a registry host before you can configure permissions for the host. In Artifact Registry, you use Artifact Registry roles to grant access, and there is a clear separation between repository administrator and repository user roles.

Google Kubernetes Engine image streaming

GKE can stream data from eligible images as requested by your applications, so that workloads can initialize without waiting for the entire image to download. Image streaming provides faster autoscaling, faster pod startup, and reduced latency when pulling large images.

Cloud Run source deployment

Deploy new services and new revisions to Cloud Run directly from source code using a single Google Cloud CLI command. Source deployment builds a container image from your code, stores it in Artifact Registry, and deploys it to Cloud Run.

Backwards compatibility and co-existence

You can use both Artifact Registry and Container Registry in the same project. When you view a list of repositories with gcloud or Cloud Console, Artifact Registry also lists Container Registry repositories in the same project.

To take advantage of the expanded capabilities in Artifact Registry, you can transition your containers and your automation to Artifact Registry.


Transitioning from Container Registry

Artifact Registry is the recommended service for container image storage and management on Google Cloud. As a fully-managed service with support for both container images and non-container artifacts, Artifact Registry extends the capabilities of Container Registry.

Although Container Registry is still available and supported as a Google Enterprise API, new features will only be available in Artifact Registry. Container Registry will only receive critical security fixes.


Store Docker container images in Artifact Registry

Artifact Registry provides a single location for managing private packages and Docker container images.

This quickstart shows you how to:

  • Create a Docker repository in Artifact Registry
  • Set up authentication
  • Push an image to the repository
  • Pull the image from the repository

Before you begin

  1. Make sure that billing is enabled for your Cloud project.
  2. Enable the Artifact Registry API.

Create a Docker repository

Create a Docker repository to store the sample image for this quickstart.

  1. Open the Repositories page in the Cloud Console.Open the Repositories page
  2. Click Create Repository.
  3. Specify quickstart-docker-repo as the repository name.
  4. Choose Docker as the format.
  5. Under Location Type, select Region and then choose the location us-central1.
  6. Click Create.

The repository is added to the repository list.


Configure authentication

Before you can push or pull images, configure Docker to use the Google Cloud CLI to authenticate requests to Artifact Registry.

To set up authentication to Docker repositories in the region us-central1, run the following command:

gcloud auth configure-docker us-central1-docker.pkg.dev

The command updates your Docker configuration. You can now connect with Artifact Registry in your Google Cloud project to push and pull images.

For information about other authentication methods, see Authentication methods.


Obtain an image to push

For this quickstart, you will push a sample image named hello-app.

  1. Change to a directory where you want to save the image.
  2. Run the following command to pull version 1.0 of the image.
docker pull us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0

Add the image to the repository

Before you push the Docker image to Artifact Registry, you must tag it with the repository name.

Tag the image with a registry name

Tagging the Docker image with a repository name configures the docker push command to push the image to a specific location. For this quickstart, the host location is us-central1-docker.pkg.dev.

Run the following command to tag the image as quickstart-image:tag1:

docker tag us-docker.pkg.dev/google-samples/containers/gke/hello-app:1.0 \
us-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1

Where

  • PROJECT is your Google Cloud project ID. If your project ID contains a colon (:), see Domain-scoped projects.
  • us-central1 is the repository location.
  • docker.pkg.dev is the hostname for Docker repositories.
  • quickstart-image is the image name you want to use in the repository. The image name can be different than the local image name.
  • tag1 is a tag you’re adding to the Docker image. If you didn’t specify a tag, Docker will apply the default tag latest.

You are now ready to push the image to the repository you created.

Push the image to Artifact Registry

After you have configured authentication and tagged the local image, you can push the image to the repository that you created.

To push the Docker image, run the following command:

docker push us-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1

Replace PROJECT with your Google Cloud project ID. If your project ID contains a colon (:), see Domain-scoped projects.


Pull the image from Artifact Registry

To pull the image from Artifact Registry onto your local machine, run the following command:

docker pull us-central1-docker.pkg.dev/PROJECT/quickstart-docker-repo/quickstart-image:tag1

Replace PROJECT with your Google Cloud project ID. If your project ID contains a colon (:), see Domain-scoped projects.

You should see output similar to the following:


Clean up

To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.

Before you remove the repository, ensure that any images you want to keep are available in another location.

To delete the repository:

  1. Open the Repositories page in the Cloud Console.Open the Repositories page
  2. In the repository list, select the quickstart-docker-repo repository.
  3. Click Delete.

Happy Learning !!!


Share At:
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Back To Top

Contact Us