Updated on 2024-12-06 GMT+08:00

Creating an Image Tag

Description

Create an image tag.

Constraints

None

API Calling

For details, see Calling APIs.

URI

POST /v2/manage/namespaces/{namespace}/repos/{repository}/tags

Table 1 Path parameters

Parameter

Mandatory

Type

Description

namespace

Yes

String

Organization name. Enter 1 to 64 characters, starting with a lowercase letter and ending with a lowercase letter or digit. Only lowercase letters, digits, periods (.), underscores (_), and hyphens (-) are allowed. Periods, underscores, and hyphens cannot be placed next to each other. A maximum of two consecutive underscores are allowed.

repository

Yes

String

Image repository name. Enter 1 to 128 characters. It must start and end with a lowercase letter or digit. Only lowercase letters, digits, periods (.), slashes (/), underscores (_), and hyphens (-) are allowed. Periods, slashes, underscores, and hyphens cannot be placed next to each other. A maximum of two consecutive underscores are allowed. Replace a slash (/) with a dollar sign ($) before you send the request.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Message body type (format). The value can be application/json or charset=utf-8 application/json.

Default value: application/json

X-Auth-Token

Yes

String

User token.

It can be obtained by calling the IAM API (value of X-Subject-Token in the response header).

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

source_tag

Yes

String

Original tag name.

destination_tag

Yes

String

New tag name.

override

No

Boolean

Whether to overwrite.

Response Parameters

None

Example Request

POST https://{endpoint}/v2/manage/namespaces/{namespace}/repos/{repository}/tags

{
  "source_tag" : "v1",
  "destination_tag" : "v2",
  "override" : false
}

Example Response

None

Status Codes

Status Code

Description

201

Created.

400

Request error.

401

Authentication failed.

404

Image repository or specified image tag not found.

409

Image tag already exists.

500

Internal error.

Error Codes

For details, see Error Codes.