二進位授權是一種部署作業期間的安全性控管機制,可確保只有受信任的容器映像檔能部署至 Cloud Run 資源。使用二進位授權之後,您就能要求映像檔在開發過程中必須由受信任的單位簽署,並在部署時強制執行簽名驗證程序。透過強制執行驗證程序,您可以確保只有通過驗證的映像檔會整合至建構與發布的程序中,藉此更嚴謹地控管容器環境。
[[["容易理解","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,["# Use Binary Authorization\n\nBinary Authorization is a deploy-time security control that ensures only trusted\ncontainer images are deployed to your Cloud Run resources. With\nBinary Authorization, you can require images to be signed by trusted\nauthorities during the development process and then enforce signature validation\nwhen deploying. By enforcing validation, you can gain tighter control over your\ncontainer environment by ensuring only verified images are integrated into the\nbuild-and-release process.\n\nLearn how to [set up Binary Authorization for Cloud Run](/binary-authorization/docs/run/overview).\n\nExempt Cloud Run functions images from Binary Authorization policy\n------------------------------------------------------------------\n\nTo deploy functions in Cloud Run, the Binary Authorization policy\nadministrator must configure a Binary Authorization policy using [allowlist patterns](/binary-authorization/docs/key-concepts#allowlist_patterns) to exempt all\nimages from the specified repository and its subdirectories.\n\n### Functions using the Cloud Run Admin API\n\nIf you are deploying your function with the\n[`gcloud run deploy...`](/sdk/gcloud/reference/run/deploy#--binary-authorization)\ncommand, use this allowlist pattern:\n\n\n\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`-docker.pkg.dev/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/cloud-run-source-deploy/**`\n\n\u003cbr /\u003e\n\nWith the allowlist enabled, deploy your function with [Binary Authorization enabled\nand set to `default`](/binary-authorization/docs/run/enabling-binauthz-cloud-run#enable-on-new-job): \n\n```sh\n gcloud run deploy YOUR_FUNCTION_NAME \\\n ...\n --binary-authorization default\n```\n\n### Functions using the Cloud Functions v2 API\n\nIf you are deploying your function with the\n[`gcloud functions deploy...`](/sdk/gcloud/reference/functions/deploy#--binary-authorization)\ncommand, use this allowlist pattern:\n\n\n\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e`-docker.pkg.dev/`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`/gcf-artifacts/**`\n\nWith the allowlist enabled, deploy your function with Binary Authorization enabled\nand set to `default`: \n\n```sh\n gcloud functions deploy YOUR_FUNCTION_NAME \\\n ...\n --binary-authorization default\n```\n\nWhat's next\n-----------\n\n- Learn how to [set up Binary Authorization for Cloud Run](/binary-authorization/docs/run/overview)."]]