Loading
close

容器镜像

time 更新时间:2026-10-08 16:41:12

容器镜像

镜像列表要求 Harbor 配置启用;按当前租户及 public 筛选项目仓库。architecture、runtime、vendor 为可选镜像筛选条件。

方法 路径(产品接口统一前缀 /api/v1) 功能
GET /images/repositories 查询镜像仓库
GET /images/tags 查询镜像标签

查询镜像仓库

功能介绍

查询镜像仓库。

访问要求:有效 Token;需要对应资源读权限,并受项目、所有者、公共或共享资源规则限制。

URI

GET /api/v1/images/repositories

查询参数

参数 类型 必选 描述
public string 否 是否为公共仓库
architecture string 否 加速器架构
runtime string 否 推理运行时
vendor string 否 筛选参数 vendor

请求消息

无请求体。

响应消息

参数 参数类型 描述
items array<harbor.imageEntry> 结果列表
total integer 匹配总数

请求示例

GET https://{endpoint}/api/v1/images/repositories
x-keystone-token: <Keystone Token>

正常响应示例

HTTP/1.1 200
Content-Type: application/json
{
  "items": [
    {
      "id": "id-example",
      "name": "示例资源",
      "harborProjectName": "",
      "public": true,
      "tagsCount": 0,
      "artifactCount": 0,
      "pullCount": 0,
      "description": "",
      "creationTime": "2026-09-21T00:00:00Z"
    }
  ],
  "total": 1
}

状态码与错误码

成功状态码:200。

HTTP error 说明
401 unauthorized authentication required
400 invalid_request 详细原因由 message 返回。
404 not_found harbor resource not found
502 backend_unavailable 详细原因由 message 返回。

此外,认证/授权中间件可返回 401 / 403;后端错误与错误封装见调用方式。

查询镜像标签

功能介绍

查询镜像标签。

访问要求:有效 Token;需要对应资源读权限,并受项目、所有者、公共或共享资源规则限制。

URI

GET /api/v1/images/tags

查询参数

参数 类型 必选 描述
project string 是 Harbor 项目名称
repository string 是 镜像仓库名称
architecture string 否 加速器架构
runtime string 否 推理运行时
vendor string 否 筛选参数 vendor

请求消息

无请求体。

响应消息

参数 参数类型 描述
tags array 镜像标签或模型标签列表

请求示例

GET https://{endpoint}/api/v1/images/tags?project=project-name&repository=repo-name
x-keystone-token: <Keystone Token>

正常响应示例

HTTP/1.1 200
Content-Type: application/json
{
  "tags": [
    ""
  ]
}

状态码与错误码

成功状态码:200。

HTTP error 说明
401 unauthorized authentication required
400 invalid_request project and repository are required
404 not_found harbor resource not found
502 backend_unavailable 详细原因由 message 返回。

此外,认证/授权中间件可返回 401 / 403;后端错误与错误封装见调用方式。

此篇文章对你是否有帮助?
没帮助
locked-file

您暂无权限访问该产品