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

## Changes

> 3 revisions in range; 1 could not be searched.

- **2022-11-14** `9909ec2e0c0e` — 1 info
  - removed the non-success response with the status `400`

[Change history](https://skmtc.dev/aliyun/apis/docker-engine-api/changes/containers/:id/wait/post.md)

---

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