Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving images from Docker registry to GCR

Google cloud run does not support the docker registry, therefore I have to manually pull the image, tag it and push it to GCR.

Container image URL should match pattern [region.]gcr.io/repo-path[:tag or @digest]

Is there any simpler way to do this?

like image 975
adam shamsudeen Avatar asked Oct 23 '25 02:10

adam shamsudeen


2 Answers

Sadly, that's the easiest way to move a Docker image from one container registry to another one.

Just for documentation purposes, I will add the steps for the benefit of the community:

  1. Pull the Docker image using the following command:

docker pull [REPOSITORY-NAME]/[IMAGE]:[TAG]

  1. Then, tag that pulled image using the following command:

docker tag [IMAGE] gcr.io/[PROJECT-ID]/[IMAGE]

  1. Push that image to your gcr repository using the following command:

docker push gcr.io/[PROJECT-ID]/[IMAGE]

like image 189
Alex Riquelme Avatar answered Oct 26 '25 00:10

Alex Riquelme


I've been working on some tooling called regclient that supports this use case. For copying a single image, the command would be:

regctl image copy ${source} ${target}

e.g.

regctl image copy ubuntu:latest gcr.io/your-project/ubuntu:latest

This checks the digests before copying with a HEAD request to allow the command to be run frequently but only using your quota when the upstream image doesn't match what's on GCR. It also copies multi-platform images which you wouldn't get with a docker pull and docker push (docker dereferences the image to your platform on the pull). And unlike the docker pull, the individual layers are only copied when they don't exist on the target registry.

If you have lots of images to continuously mirror, there's also a regsync command that copies according to a yaml file with a list of images, tags, and schedule to run the copies.

These can run as containers, but they are also available as standalone binaries that don't require docker to run.

like image 25
BMitch Avatar answered Oct 26 '25 01:10

BMitch



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!