Google Cloud Run, now available in beta, allows you to run serverless applications based on Docker containers that are automatically activated when an HTTP request comes in. Google Cloud Run is a fully managed platform and is based on Knative, which allows you to easily port your applications to any other platforms using Kubernetes.
Using Google Cloud Run, developers can package their applications into a Docker container, push the image to Google Container Registry, and then configure the endpoint where the app will be live after deploying with gcloud
. Google Cloud Run will automatically take care of running the container when requests come in, and stop the container ("scale to zero") when there are no more requests to serve. This could reduce costs for many applications, since customers will only pay for the actual time their containers are up. Google Cloud Run will also automatically scale up or down the number of containers running, based on traffic.
The major requirement an application should comply with in order to be able to run on Google Cloud Run is being stateless, since the container will be started and stopped automatically. There are also a number of other requirements that Google preliminarily lists, such as being compiled for 64-bit Linux, listening for requests on port 8080, and being up and running in less than four minutes.
Google Cloud Run could sound similar to Function as a Service (FaaS) solutions, including AWS Lambda, Google Cloud Functions, or Azure Functions, which do not require a server to be constantly running to handle requests. In reality, though, Google Cloud Run is not a FaaS solution. FaaS solutions tend to prefer building applications by running small functions that delegate a number of critical functions, such as authentication, or database access to the managed infrastructure. On a more practical level, one of Google Cloud Run main differentiators from FaaS solutions is the freedom for developers to choose any combination of programming languages and Linux-based technologies to build their apps. Additionally, using Docker containers makes it easier to test locally an app, since it will mostly run locally as it will in the Cloud.
Direct competitors to Google Cloud Run are Azure Container Instances and AWS Fargate, which also make it possible to run containers without managing the underlying infrastructure with a similar set of characteristics. In comparison to them, Google Cloud Run main differentiators are its automatic management of containers and the fact that, being based on Knative, any application developed for Google Cloud Run can be easily ported to other Kubernetes-based platforms, including Google Kubernetes Engine, or even a self-managed Kubernetes cluster.