[[["容易理解","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 (世界標準時間)。"],[],[],null,["# Configure Cloud Run services\n\nThis page provides an overview of configuration options for\nCloud Run services.\n\nAvoid cold starts and reduce latency\n------------------------------------\n\nYou can avoid cold starts for your application and reduce application latency by\nsetting a minimum number of instances. Note that setting a minimum number of\ninstances incurs cost. See\n[Set minimum instances for services](/run/docs/configuring/min-instances) to\nlearn more.\n\nCapacity\n--------\n\nYou can control the amount of [memory](/run/docs/configuring/services/memory-limits),\n[CPU](/run/docs/configuring/services/cpu), and [maximum concurrency](/run/docs/configuring/concurrency)\na service can use.\n\nUse [billing settings](/run/docs/configuring/billing-settings) to\ncontrol how you are charged, either per request and only when the instance\nprocesses a request, or for the entire lifecycle of the instance.\n\nEnvironment variables\n---------------------\n\nYou can create key-value pairs for use with your Cloud Run\nservice. See [Configure environment variables for services](/run/docs/configuring/services/environment-variables)\nto learn more.\n\nExecution environment\n---------------------\n\nCloud Run has two execution environments. Learn about the\ndifferences between both [execution environments](/run/docs/about-execution-environments)\n\nGPU\n---\n\nIf you need to host AI workloads, such as inference models and model training,\nyou can configure Cloud Run services with or without\n[GPU](/run/docs/configuring/services/gpu).\n\nGuard against high request levels\n---------------------------------\n\nYou can control how many instances your Cloud Run service creates\nto serve requests by setting\n[maximum instances](/run/docs/configuring/max-instances) and\n[minimum instances](/run/docs/configuring/min-instances). This can help to curb\ncosts and guard against\n[abnormally high request levels](/run/docs/configuring/max-instances-limits#best-practices).\n\nHealth checks\n-------------\n\nCloud Run lets you configure two types of health check probes.\nOne of the probes determines when the containers is ready to accept traffic, and\nthe other probe determines whether to restart the container. Learn more about\n[container health checks](/run/docs/configuring/healthchecks).\n\nLabels\n------\n\n[Cloud Run labels](/run/docs/configuring/services/labels) are key/value\npairs that you can apply to Cloud Run services, revisions, and Cloud Run functions. Labels\nhelp you organize your Cloud Run resources, and manage costs at scale\nwith the granularity you need.\n\nLabels you previously set for your Cloud Run functions using either\n`gcloud functions` commands or the Cloud Functions v2 API propagate to Cloud Run when you [deploy your functions in Cloud Run](/run/docs/deploy-functions).\n\nScaling\n-------\n\nBy default, Cloud Run automatically scales out to a specified or\ndefault maximum number of instances, depending on traffic and CPU utilization.\nHowever, for some use cases, you might want the ability to set a specific number\nof instances, using [manual scaling](/run/docs/configuring/services/manual-scaling).\n\nSecrets\n-------\n\nYou can use [Secret Manager](/secret-manager/docs#docs) with your\nCloud Run to securely store API keys, passwords, and other\nsensitive information. See\n[Configure secrets](/run/docs/configuring/services/secrets) to learn more.\n\nService identity\n----------------\n\nThe [Cloud Run service identity](/run/docs/configuring/services/service-identity)\nis the service account that is used as the authenticated account for accessing\nGoogle Cloud APIs from your Cloud Run instance container. We recommend\nthat you create a service account and determine the most minimal set of\npermissions that the service account needs to access specific Google Cloud\nresources.\n\nTimeouts\n--------\n\nYou can set a\n[Cloud Run request timeout](/run/docs/configuring/request-timeout) that\nspecifies the time within which a response must be returned.\n\nRecommendations\n---------------\n\nSee [Optimize with Recommender](/run/docs/recommender) to learn the\noptimizations provided by Recommender on Cloud Run.\n\nTraffic splitting\n-----------------\n\nEach time you deploy or redeploy a service, a new revision of the underlying\nCloud Run service is automatically created. See\n[Session affinity and traffic splitting](/run/docs/configuring/session-affinity#affinity-and-traffic-splitting)\nfor more details.\n\nTag services\n------------\n\nTags are key-value pairs you can apply to your resources for fine-grained access\ncontrol using Cloud Run console.\n\nTag administrators create tags for resources across Google Cloud at the\norganization or project level. Tags provides a way to conditionally allow or\ndeny policies based on whether a resource has a specific tag. To learn more,\nsee [Tag services](/run/docs/configuring/tags).\n\nVolume mounts\n-------------\n\nCloud Run volume mounts lets you access shared data stored in a\nlocal file system, such as a storage bucket or file server content, from your\ncontainer. You can mount a\n[Cloud Storage bucket](/run/docs/configuring/services/cloud-storage-volume-mounts),\nan [NFS share](/run/docs/configuring/services/nfs-volume-mounts) like a\nFilestore instance, or an [in-memory filesystem provided by Cloud Run](/run/docs/configuring/services/in-memory-volume-mounts)."]]