Using Cloud Build, can I push the resulting image to a different image registry rather than gcr.io?
Asked
Active
Viewed 505 times
1
-
Yes, you can use docker push command and push elsewhere. What did you try? – guillaume blaquiere Jan 31 '22 at 19:12
-
Wow, I feel so dumb now. After sleeping on it I see now that I could define a step in cloudbuild.yaml which `args` were `push ...` and that would push the image elsewhere. I got mislead by the comment on the `images` stanza, which says: "# By default, all built docker images will be lost once the build is complete. # Rather than writing a build step to push this image, you can simply **list the # image below and it will automatically be uploaded to Google Cloud Container # Registry.** images: - 'gcr.io/$PROJECT_ID/helloworld-image' – perepm Feb 01 '22 at 10:35
-
Note the **rather than** hehehe – perepm Feb 01 '22 at 10:36
1 Answers
1
If your build produces artifacts such as binaries or tarballs, you can choose to store them in Cloud Storage or any private third-party repository.
You can check this example to push images to Docker Hub. Note in the example build config file that REPOSITORY is the name of your Docker repository to which you're pushing the image. You should try similar steps in order to push the resulting image to a private image registry.
Doing this could also imply building repositories as in the repositories from GitHub and from repositories from GitHub Enterprise .

Osvaldo
- 473
- 1
- 12