---
source: https://iinventedlight.com/library/notes/docker-wait.md
title: "Docker wait: block until containers stop"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (Docker docs); Apache-2.0 (docker/cli); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Docker docs, docker container wait; docker/cli, container wait reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/LICENSE). Copyright Docker, Inc."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-devops: docker wait"
tags: [docker, wait, containers, exit-code, cli]
client: Librarian
sources:
  - id: S1
    title: "docker container wait"
    publisher: Docker docs
    url: https://docs.docker.com/reference/cli/docker/container/wait/
    accessed: 2026-11-18
    license: "Apache-2.0"
  - id: S2
    title: "container wait reference"
    publisher: docker/cli
    url: https://github.com/docker/cli/blob/master/docs/reference/commandline/container_wait.md
    accessed: 2026-11-18
    license: "Apache-2.0"
---
# Docker wait: block until containers stop
**Answer:** docker wait blocks until one or more containers stop, then prints their exit codes. The alias is docker container wait. If the container has already exited, docker wait returns 0.

## Examples

```bash
docker wait my_container
docker container wait my_container
```

## Notes

The command stays blocked until the named container exits, then prints the exit code. 

## Reference list

- `wait` blocks until containers stop and then prints exit codes.
- `The` command returns the exit code once the container stops.
- `wait` returns 0 if the container had already exited.

## See also

- [docker-compose-basics](https://iinventedlight.com/library/notes/docker-compose-basics/)
- [docker-volumes](https://iinventedlight.com/library/notes/docker-volumes/)

## Claims

- id: C1
  claim: wait blocks until containers stop and then prints exit codes.
  source: S1
  evidence: "Block until one or more containers stop, then print their exit codes"

- id: C2
  claim: The command returns the exit code once the container stops.
  source: S2
  evidence: "The `docker wait` command above returns the exit code"

- id: C3
  claim: wait returns 0 if the container had already exited.
  source: S2
  evidence: "`docker wait` returns `0` when run against a container which had already"

## Sources

- [S1] docker container wait. Docker docs. https://docs.docker.com/reference/cli/docker/container/wait/ . License: Apache-2.0. Accessed 2026-11-18.

- [S2] container wait reference. docker/cli. https://github.com/docker/cli/blob/master/docs/reference/commandline/container_wait.md . License: Apache-2.0. Accessed 2026-11-18.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Docker docs, docker container wait; docker/cli, container wait reference. Apache-2.0 (https://raw.githubusercontent.com/docker/docs/main/LICENSE). Copyright Docker, Inc. Apache-2.0 (https://raw.githubusercontent.com/docker/cli/master/LICENSE). Copyright Docker, Inc. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
