RetryImageCache - 重试镜像缓存

更新时间:
复制 MD 格式

重试镜像缓存

接口说明

在当前 Workspace 对原 ImageId 重试。WorkspaceId 必填,无业务请求体,可省略或提供空对象。来源授权与转存网络复用原登记的可信上下文;已有摘要时按原摘要重试,尚无摘要时重新解析原 tag。FAILED 新请求可启动一轮制作,PENDING/READY 复用,DELETING 拒绝,不新建已删除的资源。PUBLIC/PRIVATE 复用原 Workspace 拉取授权。返回完整受理快照并保持原 ImageId 和 CreatedAt。ClientToken 不保证请求去重;结果未确认时先查询实时状态,再决定是否重新提交。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

调试

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。

  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。

  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:

    • 对于必选的资源类型,用前面加 * 表示。

    • 对于不支持资源级授权的操作,用全部资源表示。

  • 条件关键字:是指云产品自身定义的条件关键字。

  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。

操作

访问级别

资源类型

条件关键字

关联操作

agentcore:RetryImageCache

none

*全部资源

*

无 无

请求语法

POST /image-caches/{imageId}/retry HTTP/1.1

路径参数

名称

类型

必填

描述

示例值

imageId

string

是

缓存记录标识

img-example

请求参数

名称

类型

必填

描述

示例值

regionId

string

是

产品入口地域,由所选地域端点确定。

cn-hangzhou

workspaceId

string

是

当前路由的 Workspace,服务端校验账号、地域及资源归属;不允许省略或访问其他 Workspace。

ws-example

clientToken

string

是

必填且非空,保留用于接口兼容。当前不提供基于此字段的请求去重或原结果恢复;超时或结果未确认时,先查询缓存状态,再决定是否重新提交。

550e8400-e29b-41d4-a716-446655440000

body

object

是

body 固定空对象 {};WorkspaceId 放 query,不传 Pool、角色、Digest 或网络。

返回参数

名称

类型

描述

示例值

object

请求处理结果。

requestId

string

请求 ID,用于排查问题。

req-example

message

string

响应消息。

success

httpStatusCode

integer

HTTP 状态码。

200

code

string

业务响应码。

SUCCESS

success

boolean

请求是否成功,不代表缓存制作完成。

true

data

object

重试镜像缓存结果。

imageId

string

当前 Workspace 可管理的逻辑资源 ID,不是共享物理缓存 ID。

img-example

workspaceId

string

与请求 Workspace 一致,禁止返回其他 Workspace 的同内容资源。

ws-example

acrInstanceId

string

源 ACR 企业版实例 ID。

cri-example

registry

string

不含协议、路径、凭证。

example-registry.cn-hangzhou.cr.aliyuncs.com

repository

string

namespace/repository,已包含命名空间。

team/app

tag

string

保留大小写;普通 tag 不允许登记为不同 Digest,仅精确小写 latest 例外。

v1

digest

string

sha256: 加 64 位小写十六进制;只描述当前登记内容,不证明旧实例已切换。

sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa

status

string

PENDING 创建中,READY 可用,FAILED 异常,DELETING 当前 Workspace 删除中。

READY

cacheSizeBytes

integer

实际缓存容量,已知值大于等于 0;未知为 null,不能用源镜像压缩大小代填。

1073741824

createdAt

string

当前 Workspace 逻辑资源创建时间,含时区 RFC3339 格式;latest 内容更新不刷新。

2026-10-10T00:00:00Z

agentCount

integer

当前 Workspace 内 useImageCache=true 且关联本逻辑资源的 Agent 去重数,大于等于 0;与 ListAllAgents 的 imageCacheId 筛选同集合。关闭即不计入,与实例占用数量无关。

0

canDelete

boolean

当前 Workspace 无开启开关的配置引用且无有效实例占用、资源不在删除中时为 true。引用状态未知应使查询失败,不能默认允许。

false

deleteBlockReason

string

canDelete=true 时为 null;否则按 DELETING、AGENT_ENABLED、INSTANCES_RELEASING 的优先级返回。Agent 数量为 0 仍可能有旧实例占用。

INSTANCES_RELEASING

error

object

FAILED 时必为非空对象,其他状态为 null;只描述当前内容和当前制作轮次。

code

string

安全且非空的当前制作错误码。

ACSCacheBuildFailed

message

string

安全且非空的展示原因,不含凭证、内部地址或堆栈。

镜像缓存制作失败,请重试。

示例

正常返回示例

JSON格式

{
  "requestId": "req-example",
  "message": "success",
  "httpStatusCode": 200,
  "code": "SUCCESS",
  "success": true,
  "data": {
    "imageId": "img-example",
    "workspaceId": "ws-example",
    "acrInstanceId": "cri-example",
    "registry": "example-registry.cn-hangzhou.cr.aliyuncs.com",
    "repository": "team/app",
    "tag": "v1",
    "digest": "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
    "status": "READY",
    "cacheSizeBytes": 1073741824,
    "createdAt": "2026-10-10T00:00:00Z",
    "agentCount": 0,
    "canDelete": false,
    "deleteBlockReason": "INSTANCES_RELEASING",
    "error": {
      "code": "ACSCacheBuildFailed",
      "message": "镜像缓存制作失败,请重试。"
    }
  }
}

错误码

HTTP status code

错误码

错误信息

描述

400 InvalidArgument The specified request parameter is invalid.
400 AcrEditionUnsupported The source ACR instance edition is not supported.
400 AcrAccountUnsupported The source ACR account is not supported.
400 AcrRegionUnsupported The source ACR region is not supported.
403 Forbidden The caller is not allowed to perform this operation.
403 AcrRamUnauthorized Source image authorization is required for image caching.
404 NotFound The specified source resource does not exist.
404 ImageCacheNotFound The specified image cache does not exist.
503 ImageCacheUnavailable No image cache execution resources are available in the requested cache region.
503 AcrAuthorizationServiceUnavailable The source ACR authorization service is unavailable.
409 ImageCacheRegionMismatch The registered cache region is incompatible with the requested region.
409 ImageCacheRetryContextMissing The stored source context is incomplete. Select the source image and access mode again.
409 ImageCacheTargetChanged The current execution configuration is incompatible with the registered cache target.
409 ImageCacheNetworkUnavailable No configured source transfer network supports the requested access modes.
409 ImageCacheDeleting The image cache is being deleted.
409 SubmissionPending The submission result is not confirmed. Query the current cache status before submitting again.
409 AcrRoleConflict The Workspace resource role configuration conflicts with the requested source.
409 AcrPrerequisiteNotReady The Workspace ACR prerequisites are not ready.
409 WorkspaceDeleting The Workspace is being deleted.
409 AcrCapacityUnsupported The source ACR capacity is not supported.
409 WorkspaceNotReady The Workspace is not ready for cache creation or retry.

访问错误中心查看更多错误码。

变更历史

更多信息,参考变更详情。