本頁面中的部分或全部資訊可能不適用於 Trusted Cloud by S3NS。
部署至 Compute Engine
Compute Engine 可直接從 Artifact Registry 存放區提取容器。
所需權限
Compute Engine 服務帳戶需要存取 Artifact Registry 的權限,才能提取容器映像檔。
根據貴機構的政策設定,系統可能會自動為預設服務帳戶授予專案的編輯者角色。強烈建議您
套用 iam.automaticIamGrantsForDefaultServiceAccounts
機構政策限制,停用自動角色授予功能。如果您是在 2024 年 5 月 3 日之後建立機構,系統預設會強制執行這項限制。
如果您停用自動角色授予功能,就必須決定要將哪些角色授予預設服務帳戶,然後自行授予這些角色。
如果預設服務帳戶已具有「編輯者」角色,建議您將「編輯者」角色替換為權限較低的角色。
以下是不同情境下,必要的存取範圍和必要角色的範例:
- 如要從 Artifact Registry 存放區提取容器映像檔,您必須將 Artifact Registry Reader 角色 (
roles/artifactregistry.reader
) 授予 Compute Engine 服務帳戶。此外,請確認已為 Cloud Storage 儲存空間值區設定 read-only
存取範圍。
- 您希望 VM 執行個體上傳至存放區。在這種情況下,您必須設定存取範圍,並授予儲存空間的寫入存取權:
read-write
、cloud-platform
或 full-control
。
- VM 執行個體隸屬於其他專案,而您要存取的存放區位於其他專案中。在含有存放區的專案中,授予執行個體服務帳戶所需的權限。
- 這些存放區位於同一個專案中,但您不希望預設服務帳戶在所有存放區中都具有相同的存取權。在這種情況下,您必須在存放區層級授予適當的權限,並在專案層級撤銷 Artifact Registry 權限。
- 這個 VM 會與自訂服務帳戶建立關聯。確認服務帳戶具備必要的權限和存取範圍。
- 您使用自訂角色授予權限,但自訂角色不包含必要的 Artifact Registry 權限。為角色新增必要的權限。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-08 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-08 (世界標準時間)。"],[[["Compute Engine can directly pull containers from Artifact Registry repositories."],["The Compute Engine service account requires Artifact Registry access to pull container images."],["Disabling the automatic Editor role grant for the default service account is recommended and may require you to manually grant specific roles."],["To pull images, the service account needs the Artifact Registry Reader role, and `read-only` access scope should be set for Cloud Storage."],["When working with multiple projects, or custom service accounts, ensure the appropriate permissions and access scopes are configured for the specific account."]]],[]]