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.