Artifact Registry doesn't monitor third-party registries for updates to images you copy to Artifact Registry. If you want to incorporate a newer version of an image into your pipeline, then you must push it to Artifact Registry.
Migration of your container images includes the following steps:
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
To initialize the gcloud CLI, run the following command:
gcloud initCreate or select a Google Cloud project.
Roles required to select or create a project
roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace PROJECT_ID with a name for the Google Cloud project you are creating.
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace PROJECT_ID with your Google Cloud project name.
Verify that billing is enabled for your Google Cloud project.
Enable the Artifact Registry API:
Roles required to enable APIs
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.
gcloud services enable artifactregistry.googleapis.com
Install the Google Cloud CLI.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
To initialize the gcloud CLI, run the following command:
gcloud initCreate or select a Google Cloud project.
Roles required to select or create a project
roles/resourcemanager.projectCreator), which contains the
resourcemanager.projects.create permission. Learn how to grant
roles.
Create a Google Cloud project:
gcloud projects create PROJECT_ID
Replace PROJECT_ID with a name for the Google Cloud project you are creating.
Select the Google Cloud project that you created:
gcloud config set project PROJECT_ID
Replace PROJECT_ID with your Google Cloud project name.
Verify that billing is enabled for your Google Cloud project.
Enable the Artifact Registry API:
Roles required to enable APIs
To enable APIs, you need the serviceusage.services.enable permission. If you
created the project, then you likely already have this permission through the
Owner role (roles/owner). Otherwise, you can get this permission through the
Service Usage Admin role (roles/serviceusage.serviceUsageAdmin).
Learn how to grant roles.
gcloud services enable artifactregistry.googleapis.com
export PROJECT=$(gcloud config get-value project)
go versionThis guide uses the following billable components of Google Cloud:
Search the files you use to build and deploy your container images for references to third-party registries, then check how often you pull the images.
In the directory with your Dockerfiles, run the command:
grep -inr -H --include Dockerfile\* "FROM" . | grep -i -v -E 'docker.pkg.dev|gcr.io'
The output looks like the following example:
./code/build/baseimage/Dockerfile:1:FROM debian:stretch
./code/build/ubuntubase/Dockerfile:1:FROM ubuntu:latest
./code/build/pythonbase/Dockerfile:1:FROM python:3.5-buster
This command searches all the Dockerfiles in your directory and identifies the "FROM" line. Adjust the command as needed to match the way you store your Dockerfiles.
grep -inr -H --include \*.yaml "image:" . | grep -i -v -E 'docker.pkg.dev|gcr.io'
./code/deploy/k8s/ubuntu16-04.yaml:63: image: busybox:1.31.1-uclibc
./code/deploy/k8s/master.yaml:26: image: kubernetes/redis:v1
kubectl get all --all-namespaces -o yaml | grep image: | grep -i -v -E 'docker.pkg.dev|gcr.io'
- image: nginx
image: nginx:latest
- image: nginx
- image: nginx
Run the previous commands for all GKE clusters across all Google Cloud projects for total coverage.
In projects that pull from third-party registries, use information about image pull frequency to determine if you usage is near or over any rate limits that the third-party registry enforces.
Create a log sink to export data to BigQuery. A log sink includes a destination and a query that selects the log entries to export. You can create a sink by querying individual projects, or you can use a script to collect data across projects.
To create a sink for a single project:
In the Google Cloud console, go to the Logs Explorer page:
If you use the search bar to find this page, then select the result whose subheading is Logging.
Choose a Google Cloud project.
On the Query builder tab, enter the following query:
resource.type="k8s_pod"
jsonPayload.reason="Pulling"
Change history filter from Last 1 hour to Last 7 Days.

Click Run Query.
After verifying that results show up correctly, click Actions > Create Sink.
In the Sink details dialog, complete the following:
image_pull_logs.Click Next.
In the Sink destination dialog, select the following values:
Click Next.
In the Choose logs to include in sink section, the query matches the query you ran in the Query builder tab.
Click Next.
Optional: Choose logs to filter out of the sink. For more information on how to query and filter Cloud Logging data, see Logging query language.
Click Create Sink.
Your log sink is created.
To create a sink for multiple projects:
Run the following commands in Cloud Shell:
PROJECTS="PROJECT-LIST"
DESTINATION_PROJECT="DATASET-PROJECT"
DATASET="DATASET-NAME"
for source_project in $PROJECTS
do
gcloud logging --project="${source_project}" sinks create image_pull_logs bigquery.googleapis.com/projects/${DESTINATION_PROJECT}/datasets/${DATASET} --log-filter='resource.type="k8s_pod" jsonPayload.reason="Pulling"'
done
where
project1 project2 project3.image_pull_logs.After you create a sink, it takes time for data to flow to BigQuery tables, depending on how frequently images are pulled.
Once you have a representative sample of image pulls that your builds make, run a query for pull frequency.
Run the following query:
SELECT
REGEXP_EXTRACT(jsonPayload.message, r'"(.*?)"') AS imageName,
COUNT(*) AS numberOfPulls
FROM
`DATASET-PROJECT.DATASET-NAME.events_*`
GROUP BY
imageName
ORDER BY
numberOfPulls DESC
where
After you have identified images from third-party registries, you are ready to copy them to Artifact Registry. The gcrane tool helps you with the copying process.
Create a text file images.txt with the names of the
images you identified. For example:
ubuntu:18.04
debian:buster
hello-world:latest
redis:buster
jupyter/tensorflow-notebook
Download gcrane.
GO111MODULE=on go get github.com/google/go-containerregistry/cmd/gcrane
Create a script named copy_images.sh to copy your list of files.
#!/bin/bash
images=$(cat images.txt)
if [ -z "${AR_PROJECT}" ]
then
echo ERROR: AR_PROJECT must be set before running this
exit 1
fi
for img in ${images}
do
gcrane cp ${img} LOCATION-docker.pkg.dev/${AR_PROJECT}/${img}
done
Replace LOCATION with the regional or multi-regional
location of the repository.
Make the script executable:
chmod +x copy_images.sh
Run the script to copy the files:
AR_PROJECT=${PROJECT}
./copy_images.sh
Make sure that permissions are configured correctly before you update and re-deploy your workloads.
For more information, see the access control documentation.
Update your Dockerfiles and your manifests to refer to Artifact Registry instead of the third-party registry.
The following example shows manifest referencing a third-party registry:
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
This updated version of the manifest points to an image on
us-docker.pkg.dev.
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: us-docker.pkg.dev/<AR_PROJECT>/nginx:1.14.2
ports:
- containerPort: 80
For a large number of manifests, use sed or another tool that can handle updates across many text files.
Re-deploy workloads with your updated manifests.
Keep track of new image pulls by running the following query in the BigQuery console:
SELECT`
FORMAT_TIMESTAMP("%D %R", timestamp) as timeOfImagePull,
REGEXP_EXTRACT(jsonPayload.message, r'"(.*?)"') AS imageName,
COUNT(*) AS numberOfPulls
FROM
`image_pull_logs.events_*`
GROUP BY
timeOfImagePull,
imageName
ORDER BY
timeOfImagePull DESC,
numberOfPulls DESC
All new image pulls should be from Artifact Registry and contain the string
docker.pkg.dev.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-07-17 UTC.