---
title: "Create a new image from a container"
method: POST
path: "/commit"
tags: ["Image"]
---

# Create a new image from a container

`POST /commit`

## Query parameters

- `container` string
- `repo` string
- `tag` string
- `comment` string
- `author` string
- `pause` boolean
- `changes` string

## Request body

- ContainerConfig — Configuration for a container that is portable between hosts
  - `ArgsEscaped` boolean — Command is already escaped (Windows only)
  - `AttachStderr` boolean — Whether to attach to `stderr`.
  - `AttachStdin` boolean — Whether to attach to `stdin`.
  - `AttachStdout` boolean — Whether to attach to `stdout`.
  - `Cmd` union — Command to run specified as a string or an array of strings.
    - string[]
    - string
  - `Domainname` string — The domain name to use for the container.
  - `Entrypoint` union — The entry point for the container as a string or an array of strings. If the array consists of exactly one empty string (`[""]`) then the entry point is reset to system default (i.e., the entry point used by docker when there is no `ENTRYPOINT` instruction in the `Dockerfile`).
    - string[]
    - string
  - `Env` string[] — A list of environment variables to set inside the container in the form `["VAR=value", ...]`. A variable without `=` is removed from the environment, rather than to have an empty value.
  - `ExposedPorts` object — An object mapping ports to an empty object in the form: `{"<port>/<tcp|udp>": {}}`
  - `Healthcheck` HealthConfig — A test to perform to check that the container is healthy.
    - `Interval` integer — The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
    - `Retries` integer — The number of consecutive failures needed to consider a container as unhealthy. 0 means inherit.
    - `StartPeriod` integer — Start period for the container to initialize before starting health-retries countdown in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
    - `Test` string[] — The test to perform. Possible values are: - `[]` inherit healthcheck from image or parent image - `["NONE"]` disable healthcheck - `["CMD", args...]` exec arguments directly - `["CMD-SHELL", command]` run command with system's default shell
    - `Timeout` integer — The time to wait before considering the check to have hung. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
  - `Hostname` string — The hostname to use for the container, as a valid RFC 1123 hostname.
  - `Image` string — The name of the image to use when creating the container
  - `Labels` object — User-defined key/value metadata.
  - `MacAddress` string — MAC address of the container.
  - `NetworkDisabled` boolean — Disable networking for the container.
  - `OnBuild` string[] — `ONBUILD` metadata that were defined in the image's `Dockerfile`.
  - `OpenStdin` boolean — Open `stdin`
  - `Shell` string[] — Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.
  - `StdinOnce` boolean — Close `stdin` after one attached client disconnects
  - `StopSignal` string — Signal to stop a container as a string or unsigned integer.
  - `StopTimeout` integer — Timeout to stop a container in seconds.
  - `Tty` boolean — Attach standard streams to a TTY, including `stdin` if it is not closed.
  - `User` string — The user that commands are run as inside the container.
  - `Volumes` object — An object mapping mount point paths inside the container to empty objects.
    - `additionalProperties` [object Object]
  - `WorkingDir` string — The working directory for commands to run in.

## Response `201`

no error

- IdResponse — Response to an API call that returns just an Id
  - `Id` string, required — The id of the newly created object.

## Other responses

- `404` — no such container
- `500` — server error

---

[API](https://skmtc.net/docker/apis/engine.md) · [All operations](https://skmtc.net/docker/apis/engine/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/docker/engine/versions/400730735b03/schema)
