Search or ask Docker

Tag an image

POST /images/{name}/tag — Docker Engine API 1.57.

View Markdown
POST/images/{name}/tag

Create a tag that refers to a source image.

This creates an additional reference (tag) to the source image. The tag can include a different repository name and/or tag. If the repository or tag already exists, it will be overwritten.

Connection and access

API connection and authentication guidance

/v1.57

No HTTP authentication requirement is declared for this operation. Transport access controls can still apply.

Parameters

name path Required

Image name or ID to tag.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

repo query

The repository to tag in. For example, someuser/someimage.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

tag query

The name of the new tag.

Type: string

All schema constraints and annotations
{
  "type": "string"
}

Request and responses

Response 201

No error

application/json

Response 201

No error

text/plain

Response 400

Bad parameter

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 404

No such image

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 409

Conflict

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Response 500

Server error

application/json

Schema: ErrorResponse

Schema example

{
  "message": "Something went wrong."
}

Referenced schemas

#/components/schemas/ErrorResponse

Complete operation contract
{
  "description": "Create a tag that refers to a source image.\n\nThis creates an additional reference (tag) to the source image. The tag\ncan include a different repository name and/or tag. If the repository\nor tag already exists, it will be overwritten.\n",
  "operationId": "ImageTag",
  "parameters": [
    {
      "description": "Image name or ID to tag.",
      "in": "path",
      "name": "name",
      "required": true,
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The repository to tag in. For example, `someuser/someimage`.",
      "in": "query",
      "name": "repo",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "The name of the new tag.",
      "in": "query",
      "name": "tag",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "201": {
      "content": {
        "application/json": {},
        "text/plain": {}
      },
      "description": "No error"
    },
    "400": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Bad parameter"
    },
    "404": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "No such image"
    },
    "409": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Conflict"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Server error"
    }
  },
  "summary": "Tag an image",
  "tags": [
    "Image"
  ]
}