I have 2 gcloud projects, say foo
and bar
. And I have a docker image named gcr.io/foo/cat:latest
in the container registry of foo
project. Need a way to promote this image to bar
project while renaming the tag to gcr.io/bar/cat:1.0.0
. How to do this within the gcloud container service of bar
project ?
Was able to get it done following this article: https://medium.com/google-cloud/using-single-docker-repository-with-multiple-gke-projects-1672689f780c
Steps:
1. Get the container builder service account ID of the bar
project from the IAM page. Hint: member name ends with @cloudbuild.gserviceaccount.com
.
2. Add new IAM member to foo
project with the service account ID we got earlier and have 'Storage Object Viewer' permissions.
Now the container builder service account of bar
project can access(pull) container images of foo
project.