blob: c08d91dd86b39b390619c66d569efca70ac1b195 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
 | <h1>docker wait</h1>  <p><br></p> <p>Block until one or more containers stop, then print their exit codes</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker wait CONTAINER [CONTAINER...]
</pre></div> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p>  <h2 id="examples">Examples</h2> <p>Start a container in the background.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker run -dit --name=my_container ubuntu bash
</pre></div> <p>Run <code class="language-plaintext highlighter-rouge">docker wait</code>, which should block until the container exits.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker wait my_container
</pre></div> <p>In another terminal, stop the first container. The <code class="language-plaintext highlighter-rouge">docker wait</code> command above returns the exit code.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker stop my_container
</pre></div> <p>This is the same <code class="language-plaintext highlighter-rouge">docker wait</code> command from above, but it now exits, returning <code class="language-plaintext highlighter-rouge">0</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker wait my_container
0
</pre></div> <div class="_attribution">
  <p class="_attribution-p">
    © 2019 Docker, Inc.<br>Licensed under the Apache License, Version 2.0.<br>Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.<br>Docker, Inc. and other parties may also have trademark rights in other terms used herein.<br>
    <a href="https://docs.docker.com/engine/reference/commandline/wait/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/wait/</a>
  </p>
</div>
 |