how to backup/download all artifact registry images

I need to take local  backup/download all artifact registry images . 

there are more than 1000+ files

How can I do that ?

 

Solved Solved
0 2 2,247
1 ACCEPTED SOLUTION

Hi @shirish,

Welcome to Google Cloud Community!

You can use the gcloud command-line tool to download all images in a repository to your local machine.

Here's the basic command you can use:

gcloud artifacts repositories list
gcloud artifacts repositories list-packages REPO_NAME
gcloud artifacts packages list-versions PACKAGE_NAME --repository=REPO_NAME
gcloud artifacts print-blob BLOB_NAME --location=REGION --artifact-url=ARTIFACT_URL
  1. List all repositories in your project using the gcloud artifacts repositories list command. Choose the repository you want to download images from and note its name.

  2. List all packages in the repository using the gcloud artifacts repositories list-packages REPO_NAME command. Choose the package you want to download images from and note its name.

  3. List all versions of the package using the gcloud artifacts packages list-versions PACKAGE_NAME --repository=REPO_NAME command. Note the version numbers of the images you want to download.

  4. Download the images by running the gcloud artifacts print-blob BLOB_NAME --location=REGION --artifact-url=ARTIFACT_URL command for each version of the package. Replace BLOB_NAME with the name of the image you want to download, REGION with the region of the repository, and ARTIFACT_URL with the URL of the image.

You can write a script that automates these commands to download all images in the repository. Note that downloading a large number of images may take a long time and consume a significant amount of network bandwidth and disk space.

Thank you

View solution in original post

2 REPLIES 2

Hi @shirish,

Welcome to Google Cloud Community!

You can use the gcloud command-line tool to download all images in a repository to your local machine.

Here's the basic command you can use:

gcloud artifacts repositories list
gcloud artifacts repositories list-packages REPO_NAME
gcloud artifacts packages list-versions PACKAGE_NAME --repository=REPO_NAME
gcloud artifacts print-blob BLOB_NAME --location=REGION --artifact-url=ARTIFACT_URL
  1. List all repositories in your project using the gcloud artifacts repositories list command. Choose the repository you want to download images from and note its name.

  2. List all packages in the repository using the gcloud artifacts repositories list-packages REPO_NAME command. Choose the package you want to download images from and note its name.

  3. List all versions of the package using the gcloud artifacts packages list-versions PACKAGE_NAME --repository=REPO_NAME command. Note the version numbers of the images you want to download.

  4. Download the images by running the gcloud artifacts print-blob BLOB_NAME --location=REGION --artifact-url=ARTIFACT_URL command for each version of the package. Replace BLOB_NAME with the name of the image you want to download, REGION with the region of the repository, and ARTIFACT_URL with the URL of the image.

You can write a script that automates these commands to download all images in the repository. Note that downloading a large number of images may take a long time and consume a significant amount of network bandwidth and disk space.

Thank you

Howdy Christian,

Very Cool! ... I tried to find docs on "gcloud artifacts print-blob" but came up blank.   Do you have a link for this?

I'm also wondering if we can use "docker" itself?  Since the artifacts in the registry are likely docker images, maybe we can use "docker save" to output and then save the images themselves?