---
title: "Create an exec instance"
method: POST
path: "/containers/{id}/exec"
tags: ["Exec"]
---

# Create an exec instance

`POST /containers/{id}/exec`

Run a command inside a running container.

## Path parameters

- `id` string, required

## Request body

- ExecCreateConfig — is a small subset of the Config struct that holds the configuration.
  - `User` string — User that will run the command
  - `Privileged` boolean — Is the container in privileged mode
  - `Tty` boolean — Attach standard streams to a tty
  - `AttachStdin` boolean — Attach the standard input, makes possible user interaction
  - `AttachStderr` boolean — Attach the standard error
  - `AttachStdout` boolean — Attach the standard output
  - `Detach` boolean — Execute in detach mode
  - `DetachKeys` string — Escape keys for detach
  - `Cmd` string[], required — Execution commands and args
  - `Env` string[] — envs for exec command in container

## Response `201`

no error

- ExecCreateResp — contains response of Remote API POST "/containers/{name:.*}/exec".
  - `Id` string — ID is the exec ID

## Other responses

- `404` — An unexpected 404 error occurred.
- `409` — container is paused
- `500` — An unexpected server error occurred.

---

[API](https://skmtc.dev/aliyun/apis/pouch-engine-api.md) · [All operations](https://skmtc.dev/aliyun/apis/pouch-engine-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/aliyun/pouch-engine-api/revisions/36d75b2825fc/schema)
