啟用重新導向功能後,用於刪除 gcr.io
路徑中映像檔的指令會刪除對應 Artifact Registry gcr.io 存放區中的映像檔,但不會刪除儲存在 Container Registry 主機上的映像檔。
如要安全地移除所有 Container Registry 映像檔,請刪除每個 Container Registry 主機名稱的 Cloud Storage 值區。
建議您先改用 Artifact Registry,再刪除 Cloud Storage 值區。
如要刪除各個 Container Registry 儲存空間值區,請按照下列步驟操作:
主控台
- 前往 Google Cloud 控制台的「Cloud Storage」頁面。
選取要刪除的儲存空間值區。在值區名稱中,
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
- gcr.io:
按一下 [Delete] (刪除),系統隨即會顯示確認對話方塊。
如要確認刪除,請輸入值區名稱,然後按一下「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,系統也會自動停用同個專案中具有已設定依附元件的任何服務。