Search or ask Docker

Create a new image from a container

POST /commit — Docker Engine API 1.57.

View Markdown
POST/commit

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

container query

The ID or name of the container to commit

Type: string

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

repo query

Repository name for the created image

Type: string

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

tag query

Tag name for the create image

Type: string

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

comment query

Commit message

Type: string

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

author query

Author of the image (e.g., John Hannibal Smith <hannibal@a-team.com>)

Type: string

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

pause query

Whether to pause the container before committing

Type: boolean

All schema constraints and annotations
{
  "default": true,
  "type": "boolean"
}

changes query

Dockerfile instructions to apply while committing

Type: string

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

Request and responses

Request

The container configuration

application/json

Schema: ContainerConfig

Response 201

no error

application/json

Schema: IDResponse

Response 404

no such container

application/json

Schema: ErrorResponse

Example

{
  "message": "No such container: c2ada9df5af8"
}

Response 500

server error

application/json

Schema: ErrorResponse

Schema example

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

Referenced schemas

#/components/schemas/ContainerConfig

#/components/schemas/ErrorResponse

#/components/schemas/IDResponse

Complete operation contract
{
  "operationId": "ImageCommit",
  "parameters": [
    {
      "description": "The ID or name of the container to commit",
      "in": "query",
      "name": "container",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Repository name for the created image",
      "in": "query",
      "name": "repo",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Tag name for the create image",
      "in": "query",
      "name": "tag",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Commit message",
      "in": "query",
      "name": "comment",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Author of the image (e.g., `John Hannibal Smith \u003channibal@a-team.com\u003e`)",
      "in": "query",
      "name": "author",
      "schema": {
        "type": "string"
      }
    },
    {
      "description": "Whether to pause the container before committing",
      "in": "query",
      "name": "pause",
      "schema": {
        "default": true,
        "type": "boolean"
      }
    },
    {
      "description": "`Dockerfile` instructions to apply while committing",
      "in": "query",
      "name": "changes",
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ContainerConfig"
        }
      }
    },
    "description": "The container configuration",
    "x-codegen-request-body-name": "containerConfig"
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/IDResponse"
          }
        }
      },
      "description": "no error"
    },
    "404": {
      "content": {
        "application/json": {
          "example": {
            "message": "No such container: c2ada9df5af8"
          },
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "no such container"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "server error"
    }
  },
  "summary": "Create a new image from a container",
  "tags": [
    "Image"
  ]
}