github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/cli/docs/reference/commandline/wait.md (about) 1 --- 2 title: "wait" 3 description: "The wait command description and usage" 4 keywords: "container, stop, wait" 5 --- 6 7 # wait 8 9 ```markdown 10 Usage: docker wait CONTAINER [CONTAINER...] 11 12 Block until one or more containers stop, then print their exit codes 13 14 Options: 15 --help Print usage 16 ``` 17 18 > **Note** 19 > 20 > `docker wait` returns `0` when run against a container which had already 21 > exited before the `docker wait` command was run. 22 23 ## Examples 24 25 Start a container in the background. 26 27 ```bash 28 $ docker run -dit --name=my_container ubuntu bash 29 ``` 30 31 Run `docker wait`, which should block until the container exits. 32 33 ```bash 34 $ docker wait my_container 35 ``` 36 37 In another terminal, stop the first container. The `docker wait` command above 38 returns the exit code. 39 40 ```bash 41 $ docker stop my_container 42 ``` 43 44 This is the same `docker wait` command from above, but it now exits, returning 45 `0`. 46 47 ```bash 48 $ docker wait my_container 49 50 0 51 ```