Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Artifact Registry에 저장된 사전 빌드된 이미지를 Cloud Run에 배포하도록 Cloud Build를 구성할 수 있습니다.
사전 빌드된 이미지를 배포하려면 다음 안내를 따르세요.
터미널 창을 엽니다(열려 있지 않은 경우).
helloworld라는 이름의 새 디렉터리를 만들고 디렉터리로 이동합니다.
mkdir helloworld
cd helloworld
다음 콘텐츠로 cloudbuild.yaml라는 파일을 만듭니다. 이 파일은 Cloud Build 구성 파일입니다. 여기에는 cloudrunservice라는 Cloud Run 서비스에서 이름이 us-docker.pkg.dev/cloudrun/container/hello인 이미지를 배포하기 위한 Cloud Build 지침이 포함되어 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eThis guide demonstrates how to use Cloud Build to deploy a containerized application image to Cloud Run.\u003c/p\u003e\n"],["\u003cp\u003eCloud Build requires specific permissions, including Cloud Run Admin, Storage Object User, and IAM Service Account User, which can be granted via \u003ccode\u003egcloud\u003c/code\u003e commands.\u003c/p\u003e\n"],["\u003cp\u003eA prebuilt image stored in Artifact Registry can be deployed to Cloud Run by creating a \u003ccode\u003ecloudbuild.yaml\u003c/code\u003e configuration file and running the \u003ccode\u003egcloud builds submit\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003eThe deployed image can be accessed and run by navigating to the Cloud Run page in the Google Cloud console and clicking on the service URL.\u003c/p\u003e\n"],["\u003cp\u003eCloud Build supports deployment to platforms other than Cloud Run, such as App Engine, GKE, and Cloud Run Functions, and Cloud Deploy can be used for continuous delivery to Cloud Run.\u003c/p\u003e\n"]]],[],null,["# Quickstart: Deploy a containerized application to Cloud Run\n\nDeploy a containerized application to Cloud Run using Cloud Build\n=================================================================\n\nThis page shows you how to use Cloud Build to deploy a containerized application\nto Cloud Run.\n| **Note:** This quickstart shows you how to deploy an image to Cloud Run, but Cloud Build supports deployments on additional platforms such as App Engine, GKE, and Cloud Run functions. \n|\n| You can also use [Cloud Deploy](/deploy/docs/deploy-app-run) to set up a continuous-delivery pipeline to deploy to Cloud Run.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nCloud Shell Editor, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/getting-started?walkthrough_tutorial_id=cloud_build_deploy)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Build, Cloud Run, Artifact Registry, and Compute Engine APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com,run.googleapis.com,artifactregistry.googleapis.com,compute.googleapis.com&redirect=https://cloud.google.com/cloud-build/docs/quickstart-deploy)\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n-\n\n\n Enable the Cloud Build, Cloud Run, Artifact Registry, and Compute Engine APIs.\n\n\n [Enable the APIs](https://console.cloud.google.com/flows/enableapi?apiid=cloudbuild.googleapis.com,run.googleapis.com,artifactregistry.googleapis.com,compute.googleapis.com&redirect=https://cloud.google.com/cloud-build/docs/quickstart-deploy)\n-\n [Install](/sdk/docs/install) the Google Cloud CLI.\n\n- If you're using an external identity provider (IdP), you must first\n [sign in to the gcloud CLI with your federated identity](/iam/docs/workforce-log-in-gcloud).\n\n-\n To [initialize](/sdk/docs/initializing) the gcloud CLI, run the following command:\n\n ```bash\n gcloud init\n ```\n\n| If you've already installed Google Cloud CLI previously, make sure you have the\n| latest available version by running `gcloud components update`.\n\nGrant permissions\n-----------------\n\nCloud Build requires **Cloud Run Admin** and **IAM Service Account User**\npermissions before it can deploy an image to Cloud Run.\n\n1. Open a terminal window.\n\n2. Set environment variables to store your project ID and project number:\n\n PROJECT_ID=$(gcloud config list --format='value(core.project)')\n PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format='value(projectNumber)')\n\n3. Grant the **Cloud Run Admin** role to the\n [Cloud Build service account](/build/docs/cloud-build-service-account):\n\n gcloud projects add-iam-policy-binding $PROJECT_ID \\\n --member=serviceAccount:$(gcloud projects describe $PROJECT_ID \\\n --format=\"value(projectNumber)\")-compute@developer.gserviceaccount.com \\\n --role=roles/run.admin\n\n4. Grant the **Storage Object User** role to the Cloud Build service account:\n\n gcloud projects add-iam-policy-binding $PROJECT_ID \\\n --member=serviceAccount:$(gcloud projects describe $PROJECT_ID \\\n --format=\"value(projectNumber)\")-compute@developer.gserviceaccount.com \\\n --role=\"roles/storage.objectUser\"\n\n5. Grant the **IAM Service Account User** role to the Cloud Build service account for the **Cloud Run runtime service account**:\n\n gcloud iam service-accounts add-iam-policy-binding $(gcloud projects describe $PROJECT_ID \\\n --format=\"value(projectNumber)\")-compute@developer.gserviceaccount.com \\\n --member=serviceAccount:$(gcloud projects describe $PROJECT_ID \\\n --format=\"value(projectNumber)\")-compute@developer.gserviceaccount.com \\\n --role=\"roles/iam.serviceAccountUser\" \\\n --project=$PROJECT_ID\n\nDeploy a prebuilt image\n-----------------------\n\nYou can configure Cloud Build to deploy a prebuilt image that is stored\nin Artifact Registry to Cloud Run.\n\nTo deploy a prebuilt image:\n\n1. Open a terminal window (if not already open).\n\n2. Create a new directory named `helloworld` and navigate into it:\n\n mkdir helloworld\n cd helloworld\n\n3. Create a file named `cloudbuild.yaml` with the following contents. This file is\n the Cloud Build config file. It contains instructions for Cloud Build\n to deploy the image named `us-docker.pkg.dev/cloudrun/container/hello` on the Cloud Run\n service named `cloudrunservice`.\n\n steps:\n - name: 'gcr.io/cloud-builders/gcloud'\n script: |\n gcloud run deploy cloudrunservice --image us-docker.pkg.dev/cloudrun/container/hello --region us-central1 --platform managed --allow-unauthenticated\n\n4. Deploy the image by running the following command:\n\n gcloud builds submit --region=us-west2 --config cloudbuild.yaml\n\nWhen the build is complete, you will see an output similar to the following: \n\n DONE\n ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\n ID CREATE_TIME DURATION SOURCE IMAGES STATUS\n 784653b2-f00e-4c4b-9f5f-96a5f115bef4 2020-01-23T14:53:13+00:00 23S gs://cloudrunqs-project_cloudbuild/source/1579791193.217726-ea20e1c787fb4784b19fb1273d032df2.tgz - SUCCESS\n\nYou've just deployed the image `hello` to Cloud Run.\n\nRun the deployed image\n----------------------\n\n1. Open the Cloud Run page in the Google Cloud console:\n\n [Open the Cloud Run page](https://console.cloud.google.com/run)\n2. Select your project and click **Open**.\n\n You will see the **Cloud Run Services** page.\n3. In the table, locate the row with the name **cloudrunservice** , and click\n **cloudrunservice**.\n\n The **Service details** page for **cloudrunservice** is displayed.\n4. To run the image that you deployed on **cloudrunservice**, click the URL:\n\nWhat's next\n-----------\n\n- [Learn how to build using Cloud Build](https://cloud.google.com/cloud-build/docs/quickstart-build).\n- [Learn how to create a basic build config file](https://cloud.google.com/cloud-build/docs/configuring-builds/create-basic-configuration).\n- [Learn how to view build results](https://cloud.google.com/cloud-build/docs/view-build-results).\n- [Learn about more ways to deploy to Cloud Run](https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-cloud-run).\n- [Learn how to deploy to Google Kubernetes Engine](https://cloud.google.com/cloud-build/docs/deploying-builds/deploy-gke).\n- [Learn more about DevOps resources](https://cloud.google.com/devops).\n- [Explore the DevOps research program](https://www.devops-research.com/research.html)."]]