---
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.
  - `Hostname` string — The hostname to use for the container, as a valid RFC 1123 hostname.
  - `Domainname` string — The domain name to use for the container.
  - `User` string — Commands run as this user inside the container. If omitted, commands run as the user specified in the image the container was started from. Can be either user-name or UID, and optional group-name or GID, separated by a colon (`<user-name|UID>[<:group-name|GID>]`).
  - `AttachStdin` boolean — Whether to attach to `stdin`.
  - `AttachStdout` boolean — Whether to attach to `stdout`.
  - `AttachStderr` boolean — Whether to attach to `stderr`.
  - `ExposedPorts` object, nullable — An object mapping ports to an empty object in the form: `{"<port>/<tcp|udp|sctp>": {}}`
  - `Tty` boolean — Attach standard streams to a TTY, including `stdin` if it is not closed.
  - `OpenStdin` boolean — Open `stdin`
  - `StdinOnce` boolean — Close `stdin` after one attached client disconnects
  - `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.
  - `Cmd` string[] — Command to run specified as a string or an array of strings.
  - `Healthcheck` HealthConfig — A test to perform to check that the container is healthy.
    - `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
    - `Interval` integer — The time to wait between checks in nanoseconds. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
    - `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.
    - `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.
    - `StartInterval` integer — The time to wait between checks in nanoseconds during the start period. It should be 0 or at least 1000000 (1 ms). 0 means inherit.
  - `ArgsEscaped` boolean, nullable — Command is already escaped (Windows only)
  - `Image` string — The name (or reference) of the image to use when creating the container, or which was used when the container was created.
  - `Volumes` object — An object mapping mount point paths inside the container to empty objects.
  - `WorkingDir` string — The working directory for commands to run in.
  - `Entrypoint` string[] — 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`).
  - `NetworkDisabled` boolean, nullable — Disable networking for the container.
  - `MacAddress` string, nullable — MAC address of the container. Deprecated: this field is deprecated in API v1.44 and up. Use EndpointSettings.MacAddress instead.
  - `OnBuild` string[], nullable — `ONBUILD` metadata that were defined in the image's `Dockerfile`.
  - `Labels` object — User-defined key/value metadata.
  - `StopSignal` string, nullable — Signal to stop a container as a string or unsigned integer.
  - `StopTimeout` integer, nullable — Timeout to stop a container in seconds.
  - `Shell` string[], nullable — Shell for when `RUN`, `CMD`, and `ENTRYPOINT` uses a shell.

## 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/chapar-rest/apis/docker-engine-api.md) · [All operations](https://skmtc.net/chapar-rest/apis/docker-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/chapar-rest/docker-engine-api/versions/3a78a994dd0d/schema)
