I'm trying to pull Docker images into Google Cloud Run. I see that I would probably need to pull it first to Google Container registry, but can I somehow avoid it? Also, I'd rather have it straight from the source to have it up-to-date.
Asked
Active
Viewed 1.4k times
36
-
Can you use an ordinary Docker image name there; `thecodingmachine/gotenberg` or `docker.io/thecodingmachine/gotenberg`? In spite of it being labeled "URL" the examples in the image aren't actually standard URLs. – David Maze Feb 22 '21 at 13:32
-
Nope, no cigar here. Looks like they have specific requirements towards that – jean d'arme Feb 22 '21 at 13:35
-
I think you need to push it first using to command ```docker push gcr.io/project-name/image-name:version.0``` then try to select it ```gcr.io/project-name/image-name:version``` to see what happened – Mahboob Feb 22 '21 at 17:15
-
I'm afraid it is impossible, according to https://cloud.google.com/run/docs/deploying#images it supports only Google Container Registry or Google Artifact Registry – yumaa Feb 22 '21 at 17:23
-
Check also "Deploying images from unsupported registries" part https://cloud.google.com/run/docs/deploying#other-registries – yumaa Feb 22 '21 at 17:23
-
@jeand'arme, don't try it, I already tried when I saw [your post](https://stackoverflow.com/questions/66269206/converting-docx-to-pdf-using-gotenberg-and-google-cloud). I pull the image locally and push it to GCR. But at the end, even if I deployed on Cloud Run, with the correct port set, there is a runtime issue because a directory is created at root path (/tiny). This container can't run on Cloud Run, today.... – guillaume blaquiere Feb 22 '21 at 19:13
-
@guillaumeblaquiere dang, it's strange. It should be working by definition and if it can't run normal Docker image then I think Google engineers should take a look into it. – jean d'arme Feb 22 '21 at 21:31
-
Are there any other solutions to that problem then? – jean d'arme Feb 22 '21 at 21:31
-
1It's an open source project. I put it in my todo to have a look on it, it's an interesting case. – guillaume blaquiere Feb 22 '21 at 22:14
2 Answers
60
I got a look on the project and finally I successfully run it on Cloud Run
Firstly, you can't pull image outside Google Container Registry or Artifact Registry. So you need to pull the image, tag it and push it in GCP (your project or not, but on GCP)
Here the steps
# Pull the image (I did it on Cloud Shell)
docker pull thecodingmachine/gotenberg:6
# Tag the image
docker tag thecodingmachine/gotenberg:6 gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6
#Push the image (no authentication issue on Cloud Shell)
docker push gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6
# Deploy on Cloud Run
gcloud run deploy --image=gcr.io/<MY_PROJECT_ID>/thecodingmachine/gotenberg:6 \
--port=3000 --region=us-central1 --allow-unauthenticated --platform=managed \
--command=gotenberg gotenberg
The trick on the Cloud Run deployment is:
- You need to specify the port, not use the default 8080, it's the 3000 here
- You need to specify the command explicitly. By default, the entrypoint is used (the
/tini
) and the container should be not well built because there is permission issue. More detail in the Dockerfile
So then, use the Cloud Run URL instead of the http://localhost:3000
that you have in the documentation and enjoy!

guillaume blaquiere
- 66,369
- 2
- 47
- 76
-
-
I don't think there's an issue with `tini` on Cloud Run. `tini` should work just fine. – ahmet alp balkan Feb 23 '21 at 00:08
-
@AhmetB-Google yes, it should work. The dockerfile perform a `chmod +x` and I don't know why I get a `terminated: Application failed to start: Failed to create init process: failed to load /tini: permission denied` in the Cloud Run logs when I don't specify the `command` parameter. You can have a try on it. – guillaume blaquiere Feb 23 '21 at 08:07
-
2
-
3For those that need it (for example, not using cloud shell, but from a workstation), to authenticate to GCR from the CLI, use `gcloud auth configure-docker` – thisjustin Sep 03 '21 at 19:23
-
Anybody know how to modify last command after "#Deploy on Cloud Run"? I would like to run seq on Google Cloud Run. # Pull the image - OK # Tag the image - OK # Push the image - OK **# Deploy on Cloud Run - NEED A HELP WITH COMMAND** `docker run --name seq -d --restart unless-stopped -e ACCEPT_EULA=Y -p 5341:80 datalust/seq:latest` – Stefan Varga Nov 06 '21 at 13:20
-
@guillaumeblaquiere so there is again the same problem, but with version 7. Can I please ask you to just peek into it? https://github.com/gotenberg/gotenberg/issues/505 – jean d'arme Sep 24 '22 at 19:26
9
Google has updated the Cloud Run setup and now supports Docker Hub images out of the box. Simply add your repo path (+ tag if you want) without any region/host and it will be pulled from Docker Hub.

eddex
- 1,622
- 1
- 15
- 37
-
So just have Dockerfile or .yaml file in your repo and it's all good? – jean d'arme Mar 05 '23 at 14:10
-
2No, the image needs to be hosted on dockerhub.com, then you can do what I described here. With the Dockerfile you can create an image using the `docker build` command. This image can be pushed to a container-registry like DockerHub. – eddex Mar 06 '23 at 13:14