---
title: "POST /containers/create"
method: POST
path: "/containers/create"
---

# POST /containers/create

`POST /containers/create`

Create a container

## Query parameters

- `name` string
- `platform` 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. Healthcheck commands should be side-effect free.
    - `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 A non-zero exit code indicates a failed healthcheck: - `0` healthy - `1` unhealthy - `2` reserved (treated as unhealthy) - other values: error running probe
    - `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. If the health check command does not complete within this timeout, the check is considered failed and the health check process is forcibly terminated without a graceful shutdown.
    - `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.
  - `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 `200`

The request has succeeded.

- ContainerCreateResponse — OK response to ContainerCreate operation
  - `Id` string, required — The ID of the created container
  - `Warnings` string[], required — Warnings encountered when creating the container

---

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