summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fstack_ls%2Findex.html
blob: 423b37d2946b422fe773ee9727b2c5058d310148 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<h1>docker stack ls</h1>  <p><br></p> <p>List stacks</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker stack ls [OPTIONS]
</pre></div> <p>Refer to the <a href="#options">options section</a> for an overview of available <a href="#options"><code class="language-plaintext highlighter-rouge">OPTIONS</code></a> for this command.</p> <h2 id="description">Description</h2> <p name="extended-description">Lists the stacks.</p> <blockquote> <p><strong>Note</strong></p> <p>This is a cluster management command, and must be executed on a swarm manager node. To learn about managers and workers, refer to the <a href="../../../swarm/index">Swarm mode section</a> in the documentation.</p> </blockquote> <p>For example uses of this command, refer to the <a href="#examples">examples section</a> below.</p> <h2 id="options">Options</h2> <table> <thead> <tr> <td>Name, shorthand</td> <td>Default</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td><code class="language-plaintext highlighter-rouge">--all-namespaces</code></td> <td></td> <td>
<a href="../../../deprecated/index" target="_blank" rel="noopener" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a><span class="badge badge-info" data-toggle="tooltip" title="This option works for the Kubernetes orchestrator.">Kubernetes</span><br>List stacks from all Kubernetes namespaces</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--format</code></td> <td></td> <td>Pretty-print stacks using a Go template</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--namespace</code></td> <td></td> <td>
<a href="../../../deprecated/index" target="_blank" rel="noopener" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a><span class="badge badge-info" data-toggle="tooltip" title="This option works for the Kubernetes orchestrator.">Kubernetes</span><br>Kubernetes namespaces to use</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--kubeconfig</code></td> <td></td> <td>
<a href="../../../deprecated/index" target="_blank" rel="noopener" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a><span class="badge badge-info" data-toggle="tooltip" title="This option works for the Kubernetes orchestrator.">Kubernetes</span><br>Kubernetes config file</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--orchestrator</code></td> <td></td> <td>
<a href="../../../deprecated/index" target="_blank" rel="noopener" class="_"><span class="badge badge-danger" data-toggle="tooltip" title="Read the deprecation reference (in a new window).">deprecated</span></a><br>Orchestrator to use (swarm|kubernetes|all)</td> </tr>  </tbody> </table>  <h2 id="examples">Examples</h2> <p>The following command shows all stacks and some additional information:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker stack ls

ID                 SERVICES            ORCHESTRATOR
myapp              2                   Kubernetes
vossibility-stack  6                   Swarm
</pre></div> <h3 id="formatting">Formatting</h3> <p>The formatting option (<code class="language-plaintext highlighter-rouge">--format</code>) pretty-prints stacks using a Go template.</p> <p>Valid placeholders for the Go template are listed below:</p> <table> <thead> <tr> <th>Placeholder</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Stack name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Services</code></td> <td>Number of services</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Orchestrator</code></td> <td>Orchestrator name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Namespace</code></td> <td>Namespace</td> </tr> </tbody> </table> <p>When using the <code class="language-plaintext highlighter-rouge">--format</code> option, the <code class="language-plaintext highlighter-rouge">stack ls</code> command either outputs the data exactly as the template declares or, when using the <code class="language-plaintext highlighter-rouge">table</code> directive, includes column headers as well.</p> <p>The following example uses a template without headers and outputs the <code class="language-plaintext highlighter-rouge">Name</code> and <code class="language-plaintext highlighter-rouge">Services</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all stacks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker stack ls --format "{{.Name}}: {{.Services}}"
web-server: 1
web-cache: 4
</pre></div> <h2 id="parent-command">Parent command</h2> <table> <thead> <tr> <th style="text-align: left">Command</th> <th style="text-align: left">Description</th> </tr> </thead> <tbody> <tr> <td style="text-align: left"><a href="../stack/index">docker stack</a></td> <td style="text-align: left">Manage Docker stacks</td> </tr> </tbody> </table> <h2 id="related-commands">Related commands</h2> <table> <thead> <tr> <td>Command</td> <td>Description</td> </tr> </thead> <tbody> <tr> <td><a href="../stack_deploy/index">docker stack deploy</a></td> <td>Deploy a new stack or update an existing stack</td> </tr> <tr> <td><a href="index">docker stack ls</a></td> <td>List stacks</td> </tr> <tr> <td><a href="../stack_ps/index">docker stack ps</a></td> <td>List the tasks in the stack</td> </tr> <tr> <td><a href="../stack_rm/index">docker stack rm</a></td> <td>Remove one or more stacks</td> </tr> <tr> <td><a href="../stack_services/index">docker stack services</a></td> <td>List the services in the stack</td> </tr> </tbody> </table> <div class="_attribution">
  <p class="_attribution-p">
    &copy; 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/stack_ls/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/stack_ls/</a>
  </p>
</div>