I have an image in registry1 and want to copy it over to a registry2.
Assuming I would get that done by running this command (as stated here):
gcloud container images add-tag \ gcr.io/registry1/image1:tag1 \ gcr.io/registry2/subdirectory/image1:tag1
But I want to create a new subdirectory within the registry2 it's being moved such as:
gcr.io/registry2/subdirectory/image1:tag1 how can I create it?
Also, I'm super new to GCR. Are these called subdirectories, folders?
These are called
repositoriesnot folders or directories! See here.BTW, Google Container Registry (gcr) doesn't provide full control on these
repositories, moreover, you can't assign specificIAMrole/s to specificrepository. to get these options, move toArtifact Registry.To create a repository in
gcr, you need to have write access to the registry. and don't do it with gcloud, I mean don't re-tag the source image while it is still in your source repo.To do that, just pull the source image locally and then re-tag it using
dockerwith the full tagthen push it and that's it! your image should be pushed to the destination repository in
registry2. See Pushing an image to a registry