Long-poll endpoint that blocks until the container exits and returns the exit code as JSON.
Surfaced by
- `docker run -d` reports `error waiting for container: Error response from daemon: 404 page not found` even when the container starts successfully — the CLI always calls /wait after start
- `docker wait ` fails outright
- Testcontainers and most orchestration tooling call this after creating a container
What it needs
`POST /containers/{id}/wait` with optional `condition` query param:
- `not-running` (default) — container is not running (exited)
- `next-exit` — wait for exit after the current run
- `removed` — waits until the container is removed
Response shape:
```json
{
"StatusCode": 0,
"Error": null
}
```
Scope
Small compared to /attach — single long-poll, no stream framing, no stdin. Just:
- Subscribe to `container.die` / `container.stop` events on the existing bus
- Block until the matching event arrives for the given ID
- Emit StatusCode from the container's exit code (need to start tracking this — currently only /exec/{id}/json does)
- Honor ctx cancellation cleanly
Bucket this with /attach implementation since they share "track container exit code" plumbing.
Long-poll endpoint that blocks until the container exits and returns the exit code as JSON.
Surfaced by
What it needs
`POST /containers/{id}/wait` with optional `condition` query param:
Response shape:
```json
{
"StatusCode": 0,
"Error": null
}
```
Scope
Small compared to /attach — single long-poll, no stream framing, no stdin. Just:
Bucket this with /attach implementation since they share "track container exit code" plumbing.