[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-09-05。"],[[["\u003cp\u003eThis guide details how to deploy a service to Cloud Run using Cloud Code for Cloud Shell.\u003c/p\u003e\n"],["\u003cp\u003eYou can deploy to either Cloud Run (fully managed) or Knative serving, each with its own configuration requirements, like selecting a region or configuring a Kubernetes cluster.\u003c/p\u003e\n"],["\u003cp\u003eDuring deployment, you can customize settings like service account, environment variables, and SQL connections in the "Advanced revision settings".\u003c/p\u003e\n"],["\u003cp\u003eCloud Code builds your image, pushes it to the registry, deploys your service to Cloud Run, and provides a URL to access your live service.\u003c/p\u003e\n"],["\u003cp\u003eAfter deployment, you can view logs, open the service URL, or enable watch mode for automatic rebuilds and redeploys when changes are made to your application.\u003c/p\u003e\n"]]],[],null,["# Deploy a service in Cloud Code for Cloud Shell\n\nThis page shows you how to deploy a service to Cloud Run using\nCloud Code for Cloud Shell.\n\nDeploying a service to Cloud Run\n--------------------------------\n\nTo deploy your service to Cloud Run:\n\n1. Open the command palette (press `Ctrl`/`Cmd`+`Shift`+`P` or click **View** \\\u003e\n **Command Palette** ) and then run the\n **Deploy to Cloud Run** command.\n\n2. In the **Deploy to Cloud Run** pane, set your Google Cloud project.\n\n3. Select a preexisting service or create a new one.\n\n4. If you're creating a new service, choose your platform preferences\n under **Deployment Platform** , either\n **Cloud Run (fully managed)** or\n **Knative serving** . For help choosing the best option for\n your development needs, see the\n [Choosing your platform guide](/run/docs/choosing-a-platform).\n\n5. If you selected **Cloud Run (fully managed)** , choose\n a region to deploy to. If you selected **Knative serving**,\n configure the Kubernetes cluster information.\n\n | **Note:** Cloud Code can only deploy to Knative serving if Knative serving is enabled as a feature on the GKE cluster. It is not compatible with the newer version of Knative serving which is installed as an Anthos fleet component with Cloud Service Mesh. The free trial period for Knative serving ended on September 30, 2021. See the [GA version documentation](/anthos/run/docs/install) for details about installing Cloud Run for Anthos as an Anthos fleet component with Anthos Service Mesh. The [past version has been archived](/anthos/run/archive/docs) but the documentation remains available for existing users.\n6. (Optional) To specify additional settings like service account, environment\n variables, and SQL connections, expand the **Advanced revision settings**\n section.\n\n The following environment variables are automatically added to the running\n containers:\n\n \u003cbr /\u003e\n\n \u003cbr /\u003e\n\n7. Under Build environment, specify whether to build locally or using\n Cloud Build.\n\n8. Specify your builder (Docker or Buildpack) and its settings.\n\n9. After you define your preferred settings, click **Deploy**.\n\n Cloud Code for Cloud Shell builds your image, pushes it to the registry, and\n deploys your service to Cloud Run. Your service is now live!\n10. View your running service by following the URL displayed in the **webview**.\n\n You can also view details of your running service by clicking the\n **Show Detailed Logs** button and looking through your verbose logs in the\n output window.\n\n11. After your session completes, right-click to use the following commands:\n\n - **View Logs:** Open the application logs of a specific deployment with the Cloud Code Logs Explorer\n - **Open URL:** Open the application service URL of a specific service in a web browser\n12. If you've turned off watch mode in your launch configuration and you want to\n make changes to your application and rebuild and redeploy the application,\n click the Cloud Code status bar and then click\n **Turn on watch mode**."]]