v1

latestSwagger 2.02026-07-17107105401.6 KB
Image

Create a new image from a container

post/commit

Query parameters

containerstring

The ID or name of the container to commit

repostring

Repository name for the created image

tagstring

Tag name for the create image

commentstring

Commit message

authorstring

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

pauseboolean

Whether to pause the container before committing

changesstring

Dockerfile instructions to apply while committing

Request body

Hostnamestring

The hostname to use for the container, as a valid RFC 1123 hostname.

Domainnamestring

The domain name to use for the container.

Userstring

The user that commands are run as inside the container.

AttachStdinboolean

Whether to attach to stdin.

AttachStdoutboolean

Whether to attach to stdout.

AttachStderrboolean

Whether to attach to stderr.

ExposedPortsobject nullable

An object mapping ports to an empty object in the form:

{"<port>/<tcp|udp|sctp>": {}}

Ttyboolean

Attach standard streams to a TTY, including stdin if it is not closed.

OpenStdinboolean

Open stdin

StdinOnceboolean

Close stdin after one attached client disconnects

Envstring[]

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.

Cmdstring[]

Command to run specified as a string or an array of strings.

ArgsEscapedboolean nullable

Command is already escaped (Windows only)

Imagestring

The name (or reference) of the image to use when creating the container, or which was used when the container was created.

Volumesobject

An object mapping mount point paths inside the container to empty objects.

WorkingDirstring

The working directory for commands to run in.

Entrypointstring[]

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).

NetworkDisabledboolean nullable

Disable networking for the container.

MacAddressstring nullable

MAC address of the container.

OnBuildstring[] nullable

ONBUILD metadata that were defined in the image's Dockerfile.

Labelsobject

User-defined key/value metadata.

StopSignalstring nullable

Signal to stop a container as a string or unsigned integer.

StopTimeoutinteger nullable

Timeout to stop a container in seconds.

Shellstring[] nullable

Shell for when RUN, CMD, and ENTRYPOINT uses a shell.

Example request

{
  "Hostname": "439f4e91bd1d",
  "ExposedPorts": {
    "80/tcp": {},
    "443/tcp": {}
  },
  "Env": [
    "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  ],
  "Cmd": [
    "/bin/sh"
  ],
  "Image": "example-image:1.0",
  "WorkingDir": "/public/",
  "Entrypoint": [],
  "OnBuild": [],
  "Labels": {
    "com.example.some-label": "some-value",
    "com.example.some-other-label": "some-other-value"
  },
  "StopSignal": "SIGTERM",
  "Shell": [
    "/bin/sh",
    "-c"
  ]
}

Response

no error

Idstring required

The id of the newly created object.