---
title: "Execute a command in a container"
method: POST
path: "/containers/{id}/exec"
---

# Execute a command in a container

`POST /containers/{id}/exec`

## Path parameters

- `id` string, required

## Request body

- ExecRequest
  - `command` string[], required
  - `detach` boolean, nullable
  - `interactive` boolean, nullable
  - `tty` boolean, nullable
  - `environment` string[]
  - `user` string, nullable
  - `workingDirectory` string, nullable

## Response `200`

Command result

- ExecResponse
  - `stdout` string[], required
  - `stderr` string[], required
  - `exitCode` integer, required

## Other responses

- `404` — Resource not found
- `501` — Operation not supported by the active backend

---

[API](https://skmtc.net/full-chaos/apis/container-compose-api.md) · [All operations](https://skmtc.net/full-chaos/apis/container-compose-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/full-chaos/container-compose-api/versions/7bf76e7a9941/schema)
