---
title: "Wait for a container"
method: POST
path: "/containers/{id}/wait"
tags: ["Container"]
---

# Wait for a container

`POST /containers/{id}/wait`

Block until a container stops, then returns the exit code.

## Path parameters

- `id` string, required

## Query parameters

- `condition` 'not-running' | 'next-exit' | 'removed'

## Response `200`

The container has exit.

- ContainerWaitResponse — OK response to ContainerWait operation
  - `StatusCode` integer, required — Exit code of the container
  - `Error` ContainerWaitExitError — container waiting error, if any
    - `Message` string — Details of an error

## Other responses

- `400` — bad parameter
- `404` — no such container
- `500` — server error

---

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