Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run function deployment with docker image

I am trying to understand if it is possible to deploy the Cloud Run function with a docker image. As I know under the hood the 2-gen of Cloud Function is Cloud Run-based and builds the docker image itself. It is not obvious to me, why we don't have a UI option to deploy with docker image, only available source code and zip. Maybe someone knows the possible way how to use the docker image for Cloud Run function deployment.

0 4 1,499
4 REPLIES 4

Deploying a function as a container is basically the same thing as deploying a Cloud Run service as a container. In both cases, you have a container that contains a web server that listens for requests. The difference with functions is that we also provide an editor that lets you write your function and then we take care of packaging it as a container; but if you already have a container, you don't need that part.

Does that make sense? 

Thank you for your reply.
I understand what you mean, but the cloud run and the cloud run function have different use cases. For my case, the cloud run function is more suitable. I want to have a possibility to trigger execution logic by some event and this is the case for the cloud run function.
Why do I need to use docker because? I want to pre-install some additional stuff for website crawling, and this is not possible with the current deployment cases (zip or source code).
If I understand correctly, for now, there is no way to deploy a cloud run function with a docker image?
What you can suggest in my case, I want to have a serverless container to up and execute logic by some trigger and I need to have the possibility to pre-install the rendering engine inside the container (like Playwright).

Thank you

Maybe this would be helpful? https://cloud.google.com/run/docs/building/functions

Also note that if you deploy a container as a Cloud Run service, you can then set it up to be triggered by Eventarc events or other triggers; it seems to me that that would match what you're looking for.

does that mean that if I run a cloud run with an HTTP trigger it won’t keep the container running in background? I do not want my container to keep running because it would be a waste of resources. What I want is to run the code only based on HTTP triggers.