Container Registry is deprecated. After May 15, 2024. Artifact Registry will host images for the gcr.io domain in projects without previous Container Registry usage. Learn more.

Enabling and disabling the service

This page describes the steps to enable and disable Container Registry.

See Pricing for information about charges for Container Registry.

See the Container Analysis documentation for information about enabling Container Analysis APIs and pricing for vulnerability scanning.

Enabling service

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project. Learn how to check if billing is enabled on a project.

  4. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  5. Make sure that billing is enabled for your Google Cloud project. Learn how to check if billing is enabled on a project.

  6. Install and initialize Google Cloud CLI if it is not already installed. To update an existing installation, run the command gcloud components update.
  7. Enable the API from Google Cloud console or with the following gcloud command:
    gcloud services enable containerregistry.googleapis.com

Disabling service

Disabling the Container Registry API does not delete container images stored in Cloud Storage buckets for registry hosts. You will continue to incur Cloud Storage storage and network egress charges for stored images.

If you are no longer using Container Registry and do not need the retain the images, delete the storage buckets.

Disable the API

To disable the API from the Google Cloud console:

console

  1. Go to the API Overview page for Container Registry.
  2. Select the project where the API is enabled.
  3. Click Manage.
  4. Click Disable API.

gcloud

Run the following command to disable the API for your current project:

gcloud services disable containerregistry.googleapis.com

Delete storage buckets

Delete the storage buckets for Container Registry if you are no longer using Container Registry

To delete each Container Registry storage bucket:

Console

  1. Go to the Cloud Storage page in the Google Cloud console.
  2. Select the storage bucket to delete. In the bucket names, PROJECT-ID is your Google Cloud project ID.

    • gcr.io: artifacts.PROJECT-ID.appspot.com
    • asia.gcr.io: asia.artifacts.PROJECT-ID.appspot.com
    • eu.gcr.io: eu.artifacts.PROJECT-ID.appspot.com
    • us.gcr.io: us.artifacts.PROJECT-ID.appspot.com
  3. Click Delete. A confirmation dialog box appears.

  4. To confirm deletion, enter the bucket name and then click Delete.

gsutil

If you want to bulk delete a hundred thousand or more images in a bucket, avoid using gsutil since the deletion process takes a long time to complete. Use Google Cloud console to perform the operation instead.

To delete a bucket, use the gsutil rm command with the -r flag.

gsutil rm -r gs://BUCKET-NAME

Replace BUCKET-NAME with the Container Registry storage bucket name. In the bucket names, PROJECT-ID is your Google Cloud project ID.

  • gcr.io: artifacts.PROJECT-ID.appspot.com
  • asia.gcr.io: asia.artifacts.PROJECT-ID.appspot.com
  • eu.gcr.io: eu.artifacts.PROJECT-ID.appspot.com
  • us.gcr.io: us.artifacts.PROJECT-ID.appspot.com

The response looks like the following example:

Removing gs://artifacts.my-project.appspot.com/...

If other Google Cloud services are running in the same Google Cloud project, leave the Container Registry API enabled. If you try to disable the Container Registry API. Container Registry displays a warning if other services with a configured dependency are enabled in the project. Disabling the Container Registry API automatically disables any services in the same project with a configured dependency, even if you are not currently using Container Registry with those services.

What's next