# Create a new image from a container


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`POST /commit`



## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data-binary @request-body \
  'http://localhost/v1.57/commit'
```


Prepare request-body using the selected media type and schema.


## Parameters

### container

Location: query. Required: no.

The ID or name of the container to commit

```json
{
  "description": "The ID or name of the container to commit",
  "in": "query",
  "name": "container",
  "pointer": "/paths/~1commit/post/parameters/0",
  "schema": {
    "type": "string"
  }
}
```

### repo

Location: query. Required: no.

Repository name for the created image

```json
{
  "description": "Repository name for the created image",
  "in": "query",
  "name": "repo",
  "pointer": "/paths/~1commit/post/parameters/1",
  "schema": {
    "type": "string"
  }
}
```

### tag

Location: query. Required: no.

Tag name for the create image

```json
{
  "description": "Tag name for the create image",
  "in": "query",
  "name": "tag",
  "pointer": "/paths/~1commit/post/parameters/2",
  "schema": {
    "type": "string"
  }
}
```

### comment

Location: query. Required: no.

Commit message

```json
{
  "description": "Commit message",
  "in": "query",
  "name": "comment",
  "pointer": "/paths/~1commit/post/parameters/3",
  "schema": {
    "type": "string"
  }
}
```

### author

Location: query. Required: no.

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

```json
{
  "description": "Author of the image (e.g., `John Hannibal Smith \u003channibal@a-team.com\u003e`)",
  "in": "query",
  "name": "author",
  "pointer": "/paths/~1commit/post/parameters/4",
  "schema": {
    "type": "string"
  }
}
```

### pause

Location: query. Required: no.

Whether to pause the container before committing

```json
{
  "description": "Whether to pause the container before committing",
  "in": "query",
  "name": "pause",
  "pointer": "/paths/~1commit/post/parameters/5",
  "schema": {
    "default": true,
    "type": "boolean"
  }
}
```

### changes

Location: query. Required: no.

`Dockerfile` instructions to apply while committing

```json
{
  "description": "`Dockerfile` instructions to apply while committing",
  "in": "query",
  "name": "changes",
  "pointer": "/paths/~1commit/post/parameters/6",
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Request  application/json

The container configuration


Schema:

```json
{
  "$ref": "#/components/schemas/ContainerConfig"
}
```










### Response 201 application/json

no error


Schema:

```json
{
  "$ref": "#/components/schemas/IDResponse"
}
```










### Response 404 application/json

no such container


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Example:
```json
{
  "message": "No such container: c2ada9df5af8"
}
```


### Response 500 application/json

server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "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"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ContainerConfig](/reference/api/engine/version/v1.57/schemas/ContainerConfig/)

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)

- [#/components/schemas/IDResponse](/reference/api/engine/version/v1.57/schemas/IDResponse/)




