Cloud Run

Deploy a container to serverless environment using a single command.

Cloud Run is a fully managed container runtime environment, where you can deploy any HTTP serving container, and Cloud Run will automatically scale out the number of instances as needed, and scale down to zero when no one is using it.

Getting Started - Click to Deploy

You can deploy a Hello World Application simply by click on the Run on Google Cloud button below!

Getting Started - Manual Deployment


cd $HOME
git clone
cd jvm-helloworld-by-example/helloworld-springboot-tomcat


./mvnw package


Enable API

Enable the Container Registry API so that you can push container images to Container Registry.

gcloud services enable


Use Jib to containerize the application:

PROJECT_ID=$(gcloud config get-value project)

./mvnw compile \${PROJECT_ID}/helloworld

Learn different ways to containerize a Java application in the Container Image section.


Enable API

# To use Cloud Run
gcloud services enable

Deploy Container

PROJECT_ID=$(gcloud config get-value project)

gcloud run deploy helloworld \
  --region=us-central1 \
  --platform=managed \
  --allow-unauthenticated \${PROJECT_ID}/helloworld


Once deployed, Cloud Run will display the HTTPs URL. You can also find the URL with the command line:

gcloud run services describe helloworld \
  --region=us-central1 \

You can curl the URL:

URL=$(gcloud run services describe helloworld \
  --region=us-central1 \
  --platform=managed \

curl ${URL}

Additional Configurations

By default, Cloud Run will deploy with the smallest 1CPU 256MB instance. You can specify a larger instance, and configure environment variables with the gcloud CLI:

PROJECT_ID=$(gcloud config get-value project)

gcloud run deploy helloworld --platform=managed --allow-unauthenticated \
  --cpu=2 --memory=512M --set-env-vars="SPRING_PROFILES_ACTIVE=prod" \${PROJECT_ID}/helloworld

Learn More

Last updated