本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
清除映像資源
本指南說明如何清理您在上一節中建立的 RStudio 映像資源。若要刪除映像,請使用 SageMaker AI 主控台或 完成下列步驟 AWS CLI,如本指南所示。
-
從 Amazon SageMaker AI 網域分離映像和映像版本。
-
刪除映像,映像版本和應用程式映像組態。
完成這些步驟後,您可以從 Amazon ECR 刪除容器映像和儲存庫。如需如何刪除容器映像和儲存庫的更多詳細資訊,請參閱刪除儲存庫。
從 SageMaker AI 主控台清除資源
當您從區域中分離映像時,會分離映像的所有版本。分離映像後,網域的所有使用者都會失去對映像版本的存取權。
若要分離映像
-
在 https://console.aws.amazon.com/sagemaker/
:// 開啟 Amazon SageMaker AI 主控台。 -
在左側導覽窗格中,選擇管理員組態。
-
在管理員組態下,選擇網域。
-
選取所需的網域。
-
選擇環境。
-
在連接至網域的自訂映像下,選擇映像,然後選擇分離。
-
(選用) 若要從 SageMaker AI 刪除映像和所有版本,請選取同時刪除選取的映像...。這不會從 Amazon ECR 中刪除相關聯的映像。
-
請選擇分離。
從 AWS CLI清理資源。
清理資源
-
透過將空白的自訂映像清單傳送至網域,從網域中分離映像和映像版本。開啟您建立於 將 SageMaker AI 映像連接到您目前的網域 的
update-domain-input.json
檔案。 -
刪除
RSessionAppSettings
自訂映像,然後儲存檔案。請勿修改KernelGatewayAppSettings
自訂映像。{ "DomainId": "d-xxxxxxxxxxxx", "DefaultUserSettings": { "KernelGatewayAppSettings": { "CustomImages": [ ], ... }, "RSessionAppSettings": { "CustomImages": [ ], "DefaultResourceSpec": { } ... } } }
-
使用網域 ID 和預設使用者設定檔案來更新您的網域。
aws sagemaker update-domain \ --domain-id
<d-xxxxxxxxxxxx>
\ --cli-input-json file://update-domain-input.json回應:
{ "DomainArn": "arn:aws:sagemaker:us-east-2:acct-id:domain/d-xxxxxxxxxxxx" }
-
刪除應用程式映像組態。
aws sagemaker delete-app-image-config \ --app-image-config-name rstudio-image-config
-
刪除 SageMaker AI 映像,也會刪除所有映像版本。Amazon ECR 中以映像版本顯示的容器映像不會被刪除。
aws sagemaker delete-image \ --image-name rstudio-image