调用DeleteImage接口,并可以指定参数ImageId、Force删除一份自定义镜像。
接口说明
对于不允许删除自定义镜像的情况以及镜像删除后的注意事项,请参见删除自定义镜像。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
授权信息
当前API暂无授权信息透出。
请求参数
| 名称 | 类型 | 必填 | 描述 | 示例值 |
|---|---|---|---|---|
| RegionId | string | 是 | 自定义镜像所在的地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。 | cn-hangzhou |
| ImageId | string | 是 | 镜像 ID。如果指定的自定义镜像不存在,则请求将被忽略。 | m-bp67acfmxazb4p**** |
| Force | boolean | 否 | 是否执行强制删除。取值范围:
默认值:false。 | false |
返回参数
示例
正常返回示例
JSON格式
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}错误码
| HTTP status code | 错误码 | 错误信息 | 描述 |
|---|---|---|---|
| 403 | ImageUsingByInstance | The specified image has been used to create instances. You can use the DescribeInstances API to query these instances, or you can use the force parameter to proceed. | 指定的镜像已被用来创建实例。您可以使用DescribeInstances API查询这些实例,或者使用'force'参数继续执行。 |
| 403 | ImageUseShared | The specified image has been shared to others. You can use the DescribeImageSharePermission API to query the users who have been shared. | 指定的镜像已经被共享给其他用户。您可以使用DescribeImageSharePermission API查询被共享的用户。 |
| 403 | OperationDenied.ImageCopying | The image is being copied. Please use the CancelCopyImage API. | 镜像正在被复制,请使用CancelCopyImage API。 |
| 403 | ImageIsImporting | The specified Image is importing. | 指定镜像正在导入,无法执行操作。 |
| 403 | ImageIsExporting | The specified image is currently being exported. You can use the DescribeTasks API to check the status of related tasks and cancel them if needed. | 指定的镜像正在被导出。您可以使用DescribeTasks API检查任务状态以及必要时取消任务。 |
| 403 | ImageIsPublic | You can not delete public image, please modify it to private. | 指定的镜像为社区镜像,不支持直接删除。您需要先调用 ModifyImageSharePermission 将社区镜像下架后,再尝试删除。 |
| 404 | InvalidImageId.NotFound | The specified ImageId does not exist. | 指定的镜像在该用户账号下不存在,请您检查镜像 ID 是否正确。 |
访问错误中心查看更多错误码。
变更历史
| 变更时间 | 变更内容概要 | 操作 |
|---|---|---|
| 2025-02-27 | OpenAPI 错误码发生变更 | 查看变更详情 |
| 2024-12-17 | OpenAPI 描述信息更新、OpenAPI 错误码发生变更 | 查看变更详情 |
