停用服務

本頁面說明如何停用 Container Registry。

停用服務

停用 Container Registry API 不會刪除容器映像檔,這些映像檔儲存在 Cloud Storage 值區中,用於容器主機。您仍須為儲存的圖片支付 Cloud Storage 儲存空間和網路輸出流量費用

如果您不再使用 Container Registry,且不需要保留映像檔,請刪除儲存值區

停用 API

如要透過 Google Cloud 控制台停用 API,請按照下列步驟操作:

主控台

  1. 前往 Container Registry 的「API 總覽」頁面。
  2. 選取已啟用 API 的專案。
  3. 點選「管理」
  4. 點選「停用 API」

gcloud

執行下列指令,為目前專案停用 API:

gcloud services disable containerregistry.googleapis.com

刪除 Storage bucket

如果您不再使用 Container Registry,請刪除其儲存值區

如要刪除各個 Container Registry 儲存空間值區,請按照下列步驟操作:

主控台

  1. 前往 Google Cloud 控制台的「Cloud Storage」頁面。
  2. 選取要刪除的儲存空間值區。在值區名稱中,PROJECT-ID 是您的 Google Cloud 專案 ID

    • gcr.io: artifacts.PROJECT-ID.appspot.com
    • asia.gcr.io: asia.artifacts.PROJECT-ID.appspot.com
    • eu.gcr.io: eu.artifacts.PROJECT-ID.appspot.com
    • us.gcr.io: us.artifacts.PROJECT-ID.appspot.com
  3. 按一下 [Delete] (刪除),系統隨即會顯示確認對話方塊。

  4. 如要確認刪除,請輸入值區名稱,然後按一下「Delete」

gcloud

如果您想大量刪除值區中的十萬張以上圖片,請避免使用 gcloud CLI,因為刪除程序需要很長的時間才能完成。請改用 Google Cloud 控制台執行這項作業。詳情請參閱批次刪除 Cloud Storage 物件

如要刪除值區,請使用 gcloud storage rm 指令搭配 --recursive 旗標。

gcloud storage rm gs://BUCKET-NAME --recursive

BUCKET-NAME 替換為 Container Registry 儲存空間值區名稱。在值區名稱中,PROJECT-ID 是您的Google Cloud 專案 ID

  • gcr.io: artifacts.PROJECT-ID.appspot.com
  • asia.gcr.io: asia.artifacts.PROJECT-ID.appspot.com
  • eu.gcr.io: eu.artifacts.PROJECT-ID.appspot.com
  • us.gcr.io: us.artifacts.PROJECT-ID.appspot.com

回應類似下列範例:

Removing gs://artifacts.my-project.appspot.com/...

如果其他 Google Cloud 服務在同一個 Google Cloud專案中執行,請保留啟用的 Container Registry API。如果您嘗試停用 Container Registry API。如果專案中啟用了其他已設定依附元件的服務,Container Registry 會顯示警告。停用 Container Registry API 後,即使您目前未在這些服務中使用 Container Registry,系統也會自動停用同個專案中具有已設定依附元件的任何服務。

後續步驟