summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html40
1 files changed, 40 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html
new file mode 100644
index 00000000..aa0431c8
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ls%2Findex.html
@@ -0,0 +1,40 @@
+<h1>docker service ls</h1> <p><br></p> <p>List services</p> <p><span class="badge badge-info" data-toggle="tooltip" data-placement="right" title="This command works with the Swarm orchestrator.">Swarm</span> This command works with the Swarm orchestrator.</p> <h2 id="usage">Usage</h2> <div class="highlight"><pre class="highlight" data-language="">$ docker service 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">This command lists services are running in the swarm.</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">--filter</code> , <code class="language-plaintext highlighter-rouge">-f</code>
+</td> <td></td> <td>Filter output based on conditions provided</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--format</code></td> <td></td> <td>Pretty-print services using a Go template</td> </tr> <tr> <td>
+<code class="language-plaintext highlighter-rouge">--quiet</code> , <code class="language-plaintext highlighter-rouge">-q</code>
+</td> <td></td> <td>Only display IDs</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <p>On a manager node:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls
+
+ID NAME MODE REPLICAS IMAGE
+c8wgl7q4ndfd frontend replicated 5/5 nginx:alpine
+dmu1ept4cxcf redis replicated 3/3 redis:3.0.6
+iwe3278osahj mongo global 7/7 mongo:3.3
+hh08h9uu8uwr job replicated-job 1/1 (3/5 completed) nginx:latest
+</pre></div> <p>The <code class="language-plaintext highlighter-rouge">REPLICAS</code> column shows both the <em>actual</em> and <em>desired</em> number of tasks for the service. If the service is in <code class="language-plaintext highlighter-rouge">replicated-job</code> or <code class="language-plaintext highlighter-rouge">global-job</code>, it will additionally show the completion status of the job as completed tasks over total tasks the job will execute.</p> <h3 id="filtering">Filtering</h3> <p>The filtering flag (<code class="language-plaintext highlighter-rouge">-f</code> or <code class="language-plaintext highlighter-rouge">--filter</code>) format is of “key=value”. If there is more than one filter, then pass multiple flags (e.g., <code class="language-plaintext highlighter-rouge">--filter "foo=bar" --filter "bif=baz"</code>)</p> <p>The currently supported filters are:</p> <ul> <li><a href="index#id">id</a></li> <li><a href="index#label">label</a></li> <li><a href="index#mode">mode</a></li> <li><a href="index#name">name</a></li> </ul> <h4 id="id">id</h4> <p>The <code class="language-plaintext highlighter-rouge">id</code> filter matches all or part of a service’s id.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls -f "id=0bcjw"
+ID NAME MODE REPLICAS IMAGE
+0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
+</pre></div> <h4 id="label">label</h4> <p>The <code class="language-plaintext highlighter-rouge">label</code> filter matches services based on the presence of a <code class="language-plaintext highlighter-rouge">label</code> alone or a <code class="language-plaintext highlighter-rouge">label</code> and a value.</p> <p>The following filter matches all services with a <code class="language-plaintext highlighter-rouge">project</code> label regardless of its value:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --filter label=project
+ID NAME MODE REPLICAS IMAGE
+01sl1rp6nj5u frontend2 replicated 1/1 nginx:alpine
+36xvvwwauej0 frontend replicated 5/5 nginx:alpine
+74nzcxxjv6fq backend replicated 3/3 redis:3.0.6
+</pre></div> <p>The following filter matches only services with the <code class="language-plaintext highlighter-rouge">project</code> label with the <code class="language-plaintext highlighter-rouge">project-a</code> value.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --filter label=project=project-a
+ID NAME MODE REPLICAS IMAGE
+36xvvwwauej0 frontend replicated 5/5 nginx:alpine
+74nzcxxjv6fq backend replicated 3/3 redis:3.0.6
+</pre></div> <h4 id="mode">mode</h4> <p>The <code class="language-plaintext highlighter-rouge">mode</code> filter matches on the mode (either <code class="language-plaintext highlighter-rouge">replicated</code> or <code class="language-plaintext highlighter-rouge">global</code>) of a service.</p> <p>The following filter matches only <code class="language-plaintext highlighter-rouge">global</code> services.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --filter mode=global
+ID NAME MODE REPLICAS IMAGE
+w7y0v2yrn620 top global 1/1 busybox
+</pre></div> <h4 id="name">name</h4> <p>The <code class="language-plaintext highlighter-rouge">name</code> filter matches on all or part of a service’s name.</p> <p>The following filter matches services with a name containing <code class="language-plaintext highlighter-rouge">redis</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --filter name=redis
+ID NAME MODE REPLICAS IMAGE
+0bcjwfh8ychr redis replicated 1/1 redis:3.0.6
+</pre></div> <h3 id="formatting">Formatting</h3> <p>The formatting options (<code class="language-plaintext highlighter-rouge">--format</code>) pretty-prints services output 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">.ID</code></td> <td>Service ID</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Service name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Mode</code></td> <td>Service mode (replicated, global)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Replicas</code></td> <td>Service replicas</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Image</code></td> <td>Service image</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Ports</code></td> <td>Service ports published in ingress mode</td> </tr> </tbody> </table> <p>When using the <code class="language-plaintext highlighter-rouge">--format</code> option, the <code class="language-plaintext highlighter-rouge">service ls</code> command will either output 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">ID</code>, <code class="language-plaintext highlighter-rouge">Mode</code>, and <code class="language-plaintext highlighter-rouge">Replicas</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all services:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ls --format "{{.ID}}: {{.Mode}} {{.Replicas}}"
+
+0zmvwuiu3vue: replicated 10/10
+fm6uf97exkul: global 5/5
+</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="../service/index">docker service</a></td> <td style="text-align: left">Manage services</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="../service_create/index">docker service create</a></td> <td>Create a new service</td> </tr> <tr> <td><a href="../service_inspect/index">docker service inspect</a></td> <td>Display detailed information on one or more services</td> </tr> <tr> <td><a href="../service_logs/index">docker service logs</a></td> <td>Fetch the logs of a service or task</td> </tr> <tr> <td><a href="index">docker service ls</a></td> <td>List services</td> </tr> <tr> <td><a href="../service_ps/index">docker service ps</a></td> <td>List the tasks of one or more services</td> </tr> <tr> <td><a href="../service_rm/index">docker service rm</a></td> <td>Remove one or more services</td> </tr> <tr> <td><a href="../service_rollback/index">docker service rollback</a></td> <td>Revert changes to a service’s configuration</td> </tr> <tr> <td><a href="../service_scale/index">docker service scale</a></td> <td>Scale one or multiple replicated services</td> </tr> <tr> <td><a href="../service_update/index">docker service update</a></td> <td>Update a service</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/service_ls/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/service_ls/</a>
+ </p>
+</div>