Copy an image from one repository to another

0 votes
How do I copy an image that I have in one repository to another registry?
Nov 14, 2019 in GCP by anonymous
• 19,610 points
3,059 views

1 answer to this question.

0 votes

You can copy an image from one repository into another using the command line. You must have access to both repositories.

To copy an image from one repository into another, use the gcloud container images add-tag command, and identify the image to be moved by its tag:

gcloud container images add-tag \
[SOURCE_HOSTNAME]/[SOURCE_PROJECT-ID]/[SOURCE_IMAGE]:[SOURCE_TAG] \
[DESTINATION_HOSTNAME]/[DESTINATION_PROJECT-ID]/[DESTINATION_IMAGE]:[DESTINATION_TAG]

or its digest:

gcloud container images add-tag \
[SOURCE_HOSTNAME]/[SOURCE_PROJECT-ID]/[SOURCE_IMAGE]@[IMAGE_DIGEST] \
[DESTINATION_HOSTNAME]/[DESTINATION_PROJECT-ID]/[DESTINATION_IMAGE]:[DESTINATION_TAG]

where, for both the source and destination:

  • [HOSTNAME] is the location where the image is hosted, and is one of four options: gcr.io, us.gcr.io, eu.gcr.io, or asia.gcr.io.

  • [PROJECT-ID] is the Google Cloud Platform Console project ID. If your project ID has a colon in it (:) seeDomain-scoped projects.

  • [IMAGE] is the image's name in Container Registry.

  • [IMAGE_DIGEST] is the sha256 hash value of the image contents.

  • [TAG] is the tag that identifies the source image to move, or the tag to apply to the image in the destination repository.

answered Nov 14, 2019 by Sirajul
• 59,230 points

Related Questions In GCP

0 votes
1 answer

How to copy an object to a folder in the bucket?

Use the gsutil cp command to create a folder ...READ MORE

answered Oct 24, 2019 in GCP by Sirajul
• 59,230 points
1,992 views
+2 votes
1 answer

How to launch one instance on GCP Cloud from command line?

Hi@akhtar, You can compute service in GCP to launch ...READ MORE

answered Aug 24, 2020 in GCP by MD
• 95,460 points
1,061 views
0 votes
1 answer

How to delete a project from Google Cloud Console

First of all, select the project you ...READ MORE

answered Apr 18, 2018 in GCP by kurt_cobain
• 9,350 points
2,928 views
0 votes
1 answer

Push an image to the container registry.

To tag the local image with the ...READ MORE

answered Nov 14, 2019 in GCP by Sirajul
• 59,230 points
1,160 views
0 votes
1 answer

Does Google cloud platform (GCP) offer IaaS ? Or just PaaS?

GCP provides IaaS as well, although it ...READ MORE

answered Sep 20, 2019 in GCP by Sirajul
• 59,230 points
7,037 views
0 votes
1 answer

How do I create a VPCN (Virtual private cloud network) on Google Cloud?

You can connect various GCP resources to each ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points
1,854 views
0 votes
1 answer

Cloud SQL of google cloud is IaaS or PaaS?

Cloud SQL is PAAS (Plaform As A ...READ MORE

answered Sep 23, 2019 in GCP by Sirajul
• 59,230 points
4,017 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP