Created
September 26, 2017 10:14
-
-
Save ricky26/fd376f1bac667c47448cff60c78f4a9b to your computer and use it in GitHub Desktop.
Google Cloud shell script for copying Container Registry images between projects
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SRC_PROJECT=$1 | |
DEST_PROJECT=$2 | |
shift 2 | |
IMAGES=$@ | |
for image in $IMAGES; do | |
src_image=$SRC_PROJECT/$image | |
gcloud docker -- pull $src_image & | |
done | |
wait | |
for image in $IMAGES; do | |
src_image=$SRC_PROJECT/$image | |
dest_image=$DEST_PROJECT/$image | |
gcloud docker -- tag $src_image $dest_image | |
gcloud docker -- push $dest_image & | |
done | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment