{"id":124779,"date":"2026-07-31T13:49:07","date_gmt":"2026-07-31T08:19:07","guid":{"rendered":"https:\/\/www.guvi.in\/blog\/?p=124779"},"modified":"2026-07-31T13:49:09","modified_gmt":"2026-07-31T08:19:09","slug":"google-cloud-run-tutorial","status":"publish","type":"post","link":"https:\/\/www.guvi.in\/blog\/google-cloud-run-tutorial\/","title":{"rendered":"Google Cloud Run Tutorial: Build, Deploy, and Scale Apps Easily"},"content":{"rendered":"\n<p>Deploying apps should not always mean managing servers, scaling rules, or infrastructure headaches. Google Cloud Run makes it easier to run containerized apps on a fully managed serverless platform.<\/p>\n\n\n\n<p>In this Google Cloud Run tutorial, you will learn how to deploy a containerized app, update it, monitor logs, and clean up resources step by step. Read the full blog to understand how Cloud Run helps developers ship apps faster without handling server management.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>TL;DR<\/strong><\/h2>\n\n\n\n<ul>\n<li>Google Cloud Run runs containerized apps without server management.<\/li>\n\n\n\n<li>It supports apps built with Node.js, Python, Go, Java, Ruby, .NET, and more.<\/li>\n\n\n\n<li>Developers can deploy containers from Artifact Registry or other supported image sources.<\/li>\n\n\n\n<li>Cloud Run automatically scales apps based on traffic.<\/li>\n\n\n\n<li>It is useful for APIs, microservices, web apps, background jobs, and event-driven workloads.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>What is Google Cloud Run?<\/strong><\/h2>\n\n\n\n<p>Google Cloud Run is a fully managed serverless platform from Google Cloud that lets developers deploy and run containerized applications.<\/p>\n\n\n\n<p>Instead of creating virtual machines, setting up servers, or managing clusters, you package your application into a container and deploy it to Cloud Run. Google Cloud handles the infrastructure, scaling, load balancing, and service availability.<\/p>\n\n\n\n<p>Cloud Run is useful when you want to run apps that respond to HTTP requests, APIs, webhooks, <a href=\"https:\/\/www.guvi.in\/blog\/guide-to-microservices-architecture\/\" target=\"_blank\" rel=\"noreferrer noopener\">microservices<\/a>, or event-based workloads. It gives developers the flexibility of containers with the simplicity of serverless deployment.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Google Cloud Run Tutorial: Deploy Containerized Apps Without Managing Servers<\/strong><\/h2>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>1. Set Up Your Google Cloud Project<\/strong><\/h3>\n\n\n\n<p>Start by creating or selecting a Google Cloud project. This project will hold your Cloud Run service, container image, billing setup, and deployment configuration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud config set project PROJECT_ID<\/code><\/pre>\n\n\n\n<p>Next, enable the required Google Cloud services.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud services enable run.googleapis.com cloudbuild.googleapis.com artifactregistry.googleapis.com<\/code><\/pre>\n\n\n\n<p>Cloud Run is a fully managed platform that runs containerized applications on Google\u2019s infrastructure, so developers do not need to manage servers directly.&nbsp;<\/p>\n\n\n\n<p><strong>2. Create a Simple Application<\/strong><\/p>\n\n\n\n<p>Create a basic application that listens for HTTP requests. Cloud Run supports apps written in many languages, including Node.js, Python, Go, Java, <a href=\"https:\/\/www.guvi.in\/blog\/ruby-on-rails-for-backend-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">Ruby<\/a>, and .NET.\u00a0<\/p>\n\n\n\n<p>For a <a href=\"https:\/\/www.guvi.in\/blog\/best-nodejs-frameworks-guide\/\" target=\"_blank\" rel=\"noreferrer noopener\">Node.js<\/a> example, create an index.js file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>const express = require(\"express\");\n\nconst app = express();\n\nconst PORT = process.env.PORT || 8080;\n\napp.get(\"\/\", (req, res) =&gt; {\n\n&nbsp;&nbsp;res.send(\"Hello from Google Cloud Run!\");\n\n});\n\napp.listen(PORT, () =&gt; {\n\n&nbsp;&nbsp;console.log(`App running on port ${PORT}`);\n\n});<\/code><\/pre>\n\n\n\n<p>Cloud Run expects the container to listen on the port provided through the PORT environment variable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>3. Add a Package File<\/strong><\/h3>\n\n\n\n<p>Create a package.json file to define dependencies and the start command.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n\n&nbsp;&nbsp;\"name\": \"cloud-run-demo\",\n\n&nbsp;&nbsp;\"version\": \"1.0.0\",\n\n&nbsp;&nbsp;\"main\": \"index.js\",\n\n&nbsp;&nbsp;\"scripts\": {\n\n&nbsp;&nbsp;&nbsp;&nbsp;\"start\": \"node index.js\"\n\n&nbsp;&nbsp;},\n\n&nbsp;&nbsp;\"dependencies\": {\n\n&nbsp;&nbsp;&nbsp;&nbsp;\"express\": \"^4.18.2\"\n\n&nbsp;&nbsp;}\n\n}<\/code><\/pre>\n\n\n\n<p>This tells the container how to start the application after deployment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>4. Create a Dockerfile<\/strong><\/h3>\n\n\n\n<p>A Dockerfile packages your application, runtime, and dependencies into one portable container image.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>FROM node:20-slim\n\nWORKDIR \/app\n\nCOPY package*.json .\/\n\nRUN npm install\n\nCOPY . .\n\nCMD &#91;\"npm\", \"start\"]<\/code><\/pre>\n\n\n\n<p>This image contains everything your app needs to run on Cloud Run.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>5. Create an Artifact Registry Repository<\/strong><\/h3>\n\n\n\n<p>Artifact Registry stores your container images before deployment.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud artifacts repositories create cloud-run-repo \\\n\n&nbsp;&nbsp;--repository-format=docker \\\n\n&nbsp;&nbsp;--location=us-central1 \\\n\n&nbsp;&nbsp;--description=\"Cloud Run container images\"<\/code><\/pre>\n\n\n\n<p>This repository will hold the <a href=\"https:\/\/www.guvi.in\/blog\/what-is-docker-in-devops\/\" target=\"_blank\" rel=\"noreferrer noopener\">Docker<\/a> image used by Cloud Run.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>6. Build and Push the Container Image<\/strong><\/h3>\n\n\n\n<p>Use Cloud Build to build the image and push it to Artifact Registry.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud builds submit \\\n\n&nbsp;&nbsp;--tag us-central1-docker.pkg.dev\/PROJECT_ID\/cloud-run-repo\/cloud-run-demo<\/code><\/pre>\n\n\n\n<p>Google Cloud Run can deploy container images to a new service or a new revision of an existing service.&nbsp;<\/p>\n\n\n\n<p><em>Build job-ready DevOps skills with HCL GUVI\u2019s <\/em><a href=\"https:\/\/www.guvi.in\/zen-class\/devops-course\/?utm_source=blog&amp;utm_medium=hyperlink&amp;utm_campaign=google-cloud-run-tutorial-build-deploy-and-scale-apps-easily\" target=\"_blank\" rel=\"noreferrer noopener\"><em>DevOps Course<\/em><\/a><em>. Learn CI\/CD, cloud deployment, containerization, infrastructure automation, and real-world DevOps workflows through live and recorded sessions, NSDC and HCL GUVI certification, 140+ hours of high-impact training, and access to 1000+ hiring partners.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>7. Deploy the Container to Cloud Run<\/strong><\/h3>\n\n\n\n<p>Deploy the container image as a Cloud Run service.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud run deploy cloud-run-demo \\\n\n&nbsp;&nbsp;--image us-central1-docker.pkg.dev\/PROJECT_ID\/cloud-run-repo\/cloud-run-demo \\\n\n&nbsp;&nbsp;--platform managed \\\n\n&nbsp;&nbsp;--region us-central1 \\\n\n&nbsp;&nbsp;--allow-unauthenticated<\/code><\/pre>\n\n\n\n<p>The gcloud run deploy command creates or updates a Cloud Run service.&nbsp;<\/p>\n\n\n\n<p><strong>8. Open the Service URL<\/strong><\/p>\n\n\n\n<p>After deployment, Cloud Run provides a public service URL.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud run services describe cloud-run-demo \\\n\n&nbsp;&nbsp;--region us-central1 \\\n\n&nbsp;&nbsp;--format=\"value(status.url)\"<\/code><\/pre>\n\n\n\n<p>Open the URL in your browser. You should see your application response.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>9. Update the Application<\/strong><\/h3>\n\n\n\n<p>Make a small change in your application code, then rebuild and redeploy the image.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud builds submit \\\n\n&nbsp;&nbsp;--tag us-central1-docker.pkg.dev\/PROJECT_ID\/cloud-run-repo\/cloud-run-demo\n\ngcloud run deploy cloud-run-demo \\\n\n&nbsp;&nbsp;--image us-central1-docker.pkg.dev\/PROJECT_ID\/cloud-run-repo\/cloud-run-demo \\\n\n&nbsp;&nbsp;--region us-central1<\/code><\/pre>\n\n\n\n<p>Cloud Run creates a new revision for every deployment. This makes updates easier to manage without manually handling servers.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>10. Configure Environment Variables<\/strong><\/h3>\n\n\n\n<p>Many applications need environment variables for <a href=\"https:\/\/www.guvi.in\/hub\/network-programming-with-python\/understanding-apis\/\" target=\"_blank\" rel=\"noreferrer noopener\">API keys<\/a>, database URLs, feature flags, or runtime settings.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud run services update cloud-run-demo \\\n\n&nbsp;&nbsp;--region us-central1 \\\n\n&nbsp;&nbsp;--set-env-vars NODE_ENV=production<\/code><\/pre>\n\n\n\n<p>Environment variables help keep configuration separate from application code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>11. Check Logs and Monitor the Service<\/strong><\/h3>\n\n\n\n<p>Use logs to troubleshoot errors and review service activity.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud logging read \"resource.type=cloud_run_revision\" --limit=20<\/code><\/pre>\n\n\n\n<p>You can also open Cloud Run in the Google Cloud Console to view traffic, revisions, logs, metrics, and settings.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>12. Clean Up Resources<\/strong><\/h3>\n\n\n\n<p>Remove the Cloud Run service when it is no longer needed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gcloud run services delete cloud-run-demo \\\n  --region us-central1\n<\/code><\/pre>\n\n\n\n<p>Cleaning up unused services helps control cloud costs.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Conclusion<\/strong><\/h2>\n\n\n\n<p>Google Cloud Run is a practical choice for teams that want to deploy containerized apps without managing servers. It lets developers focus on application logic while Google Cloud handles infrastructure, scaling, and runtime management.<\/p>\n\n\n\n<p>With a simple workflow, you can build a container image, push it to Artifact Registry, deploy it to Cloud Run, update the service, check logs, and remove resources when needed. This makes Cloud Run useful for modern apps, APIs, microservices, and quick production deployments.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>FAQs<\/strong><\/h2>\n\n\n<div id=\"rank-math-faq\" class=\"rank-math-block\">\n<div class=\"rank-math-list \">\n<div id=\"faq-question-1784585853145\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>What is Google Cloud Run used for?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Google Cloud Run is used to deploy and run containerized apps, APIs, microservices, and event-driven workloads without managing servers.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1784585867011\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>Is Google Cloud Run serverless?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, Google Cloud Run is serverless. Google Cloud manages the infrastructure, scaling, and runtime environment for your containerized app.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1784585868045\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>Does Cloud Run need Docker?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Cloud Run runs containers, so your app needs a container image. Docker is commonly used to build that image.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1784585869077\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>Can Cloud Run scale automatically?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, Cloud Run automatically scales services based on incoming traffic. It can also scale down when there is no traffic.<\/p>\n\n<\/div>\n<\/div>\n<div id=\"faq-question-1784585938379\" class=\"rank-math-list-item\">\n<h3 class=\"rank-math-question \"><strong>Is Google Cloud Run good for beginners?<\/strong><\/h3>\n<div class=\"rank-math-answer \">\n\n<p>Yes, Google Cloud Run is beginner-friendly for developers who understand basic containers and want to deploy apps without managing servers.<\/p>\n\n<\/div>\n<\/div>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Deploying apps should not always mean managing servers, scaling rules, or infrastructure headaches. Google Cloud Run makes it easier to run containerized apps on a fully managed serverless platform. In this Google Cloud Run tutorial, you will learn how to deploy a containerized app, update it, monitor logs, and clean up resources step by step. [&hellip;]<\/p>\n","protected":false},"author":60,"featured_media":128520,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[294],"tags":[],"views":"33","authorinfo":{"name":"Vaishali","url":"https:\/\/www.guvi.in\/blog\/author\/vaishali\/"},"thumbnailURL":"https:\/\/www.guvi.in\/blog\/wp-content\/uploads\/2026\/07\/Google-Cloud-Run-Tutorial-300x116.webp","_links":{"self":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/124779"}],"collection":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/users\/60"}],"replies":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/comments?post=124779"}],"version-history":[{"count":5,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/124779\/revisions"}],"predecessor-version":[{"id":128523,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/posts\/124779\/revisions\/128523"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media\/128520"}],"wp:attachment":[{"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/media?parent=124779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/categories?post=124779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.guvi.in\/blog\/wp-json\/wp\/v2\/tags?post=124779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}