Google Cloud Container Registry

Storing container images in GCP.

This is an older version of the ZenML documentation. To read and view the latest version please visit this up-to-date URL.

Google Cloud Container Registry

The GCP container registry is a container registry flavor that comes built-in with ZenML and uses the Google Artifact Registry or the Google Container Registry to store container images.

When to use it

You should use the GCP container registry if:

  • one or more components of your stack need to pull or push container images.

  • you have access to GCP. If you're not using GCP, take a look at the other container registry flavors.

How to deploy it

When using the Google Container Registry, all you need to do is enable it here.

Infrastructure Deployment

A GCP Container Registry can be deployed directly from the ZenML CLI:

zenml container-registry deploy gcp_container_registry --flavor=gcp ...

You can pass other configuration specific to the stack components as key-value arguments. If you don't provide a name, a random one is generated for you. For more information about how to work use the CLI for this, please refer to the dedicated documentation section.

How to find the registry URI

When using the Google Container Registry, the GCP container registry URI should have one of the following formats:

gcr.io/<PROJECT_ID>
# or
us.gcr.io/<PROJECT_ID>
# or
eu.gcr.io/<PROJECT_ID>
# or
asia.gcr.io/<PROJECT_ID>

# Examples:
gcr.io/zenml
us.gcr.io/my-project
asia.gcr.io/another-project

To figure out the URI for your registry:

  • Go to the GCP console.

  • Click on the dropdown menu in the top left to get a list of available projects with their names and IDs.

  • Use the ID of the project you want to use fill in the template gcr.io/<PROJECT_ID> and get your URI (You can also use the other prefixes <us/eu/asia>.gcr.io as explained above if you want your images stored in a different region).

Infrastructure Deployment

A GCP Container Registry can be deployed directly from the ZenML CLI:

zenml container-registry deploy gcp_container_registry --flavor=gcp ...

You can pass other configurations specific to the stack components as key-value arguments. If you don't provide a name, a random one is generated for you. For more information about how to work use the CLI for this, please refer to the dedicated documentation section.

How to use it

To use the GCP container registry, we need:

  • Docker installed and running.

  • The GCP CLI installed and authenticated.

  • The registry URI. Check out the previous section on the URI format and how to get the URI for your registry.

We can then register the container registry and use it in our active stack:

zenml container-registry register <NAME> \
    --flavor=gcp \
    --uri=<REGISTRY_URI>

# Add the container registry to the active stack
zenml stack update -c <NAME>

Additionally, we'll need to configure Docker, so it can pull and push images:

gcloud auth configure-docker

For more information and a full list of configurable attributes of the GCP container registry, check out the API Docs .

Last updated