summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%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_ps%2Findex.html
new repository
Diffstat (limited to 'devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%2Findex.html')
-rw-r--r--devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%2Findex.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%2Findex.html b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%2Findex.html
new file mode 100644
index 00000000..77b359ac
--- /dev/null
+++ b/devdocs/docker/engine%2Freference%2Fcommandline%2Fservice_ps%2Findex.html
@@ -0,0 +1,64 @@
+<h1>docker service ps</h1> <p><br></p> <p>List the tasks of one or more 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 ps [OPTIONS] SERVICE [SERVICE...]
+</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 tasks that are running as part of the specified services.</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 tasks using a Go template</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--no-resolve</code></td> <td></td> <td>Do not map IDs to Names</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--no-trunc</code></td> <td></td> <td>Do not truncate output</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 task IDs</td> </tr> </tbody> </table> <h2 id="examples">Examples</h2> <h3 id="list-the-tasks-that-are-part-of-a-service">List the tasks that are part of a service</h3> <p>The following command shows all the tasks that are part of the <code class="language-plaintext highlighter-rouge">redis</code> service:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+0qihejybwf1x redis.1 redis:3.0.5 manager1 Running Running 8 seconds
+bk658fpbex0d redis.2 redis:3.0.5 worker2 Running Running 9 seconds
+5ls5s5fldaqg redis.3 redis:3.0.5 worker1 Running Running 9 seconds
+8ryt076polmc redis.4 redis:3.0.5 worker1 Running Running 9 seconds
+1x0v8yomsncd redis.5 redis:3.0.5 manager1 Running Running 8 seconds
+71v7je3el7rr redis.6 redis:3.0.5 worker2 Running Running 9 seconds
+4l3zm9b7tfr7 redis.7 redis:3.0.5 worker2 Running Running 9 seconds
+9tfpyixiy2i7 redis.8 redis:3.0.5 worker1 Running Running 9 seconds
+3w1wu13yupln redis.9 redis:3.0.5 manager1 Running Running 8 seconds
+8eaxrb2fqpbn redis.10 redis:3.0.5 manager1 Running Running 8 seconds
+</pre></div> <p>In addition to <em>running</em> tasks, the output also shows the task history. For example, after updating the service to use the <code class="language-plaintext highlighter-rouge">redis:3.0.6</code> image, the output may look like this:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+50qe8lfnxaxk redis.1 redis:3.0.6 manager1 Running Running 6 seconds ago
+ky2re9oz86r9 \_ redis.1 redis:3.0.5 manager1 Shutdown Shutdown 8 seconds ago
+3s46te2nzl4i redis.2 redis:3.0.6 worker2 Running Running less than a second ago
+nvjljf7rmor4 \_ redis.2 redis:3.0.6 worker2 Shutdown Rejected 23 seconds ago "No such image: redis@sha256:6…"
+vtiuz2fpc0yb \_ redis.2 redis:3.0.5 worker2 Shutdown Shutdown 1 second ago
+jnarweeha8x4 redis.3 redis:3.0.6 worker1 Running Running 3 seconds ago
+vs448yca2nz4 \_ redis.3 redis:3.0.5 worker1 Shutdown Shutdown 4 seconds ago
+jf1i992619ir redis.4 redis:3.0.6 worker1 Running Running 10 seconds ago
+blkttv7zs8ee \_ redis.4 redis:3.0.5 worker1 Shutdown Shutdown 11 seconds ago
+</pre></div> <p>The number of items in the task history is determined by the <code class="language-plaintext highlighter-rouge">--task-history-limit</code> option that was set when initializing the swarm. You can change the task history retention limit using the <a href="../swarm_update/index"><code class="language-plaintext highlighter-rouge">docker swarm update</code></a> command.</p> <p>When deploying a service, docker resolves the digest for the service’s image, and pins the service to that digest. The digest is not shown by default, but is printed if <code class="language-plaintext highlighter-rouge">--no-trunc</code> is used. The <code class="language-plaintext highlighter-rouge">--no-trunc</code> option also shows the non-truncated task ID, and error-messages, as can be seen below;</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps --no-trunc redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+50qe8lfnxaxksi9w2a704wkp7 redis.1 redis:3.0.6@sha256:6a692a76c2081888b589e26e6ec835743119fe453d67ecf03df7de5b73d69842 manager1 Running Running 5 minutes ago
+ky2re9oz86r9556i2szb8a8af \_ redis.1 redis:3.0.5@sha256:f8829e00d95672c48c60f468329d6693c4bdd28d1f057e755f8ba8b40008682e worker2 Shutdown Shutdown 5 minutes ago
+bk658fpbex0d57cqcwoe3jthu redis.2 redis:3.0.6@sha256:6a692a76c2081888b589e26e6ec835743119fe453d67ecf03df7de5b73d69842 worker2 Running Running 5 seconds
+nvjljf7rmor4htv7l8rwcx7i7 \_ redis.2 redis:3.0.6@sha256:6a692a76c2081888b589e26e6ec835743119fe453d67ecf03df7de5b73d69842 worker2 Shutdown Rejected 5 minutes ago "No such image: redis@sha256:6a692a76c2081888b589e26e6ec835743119fe453d67ecf03df7de5b73d69842"
+</pre></div> <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 a <code class="language-plaintext highlighter-rouge">key=value</code> pair. 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>). Multiple filter flags are combined as an <code class="language-plaintext highlighter-rouge">OR</code> filter. For example, <code class="language-plaintext highlighter-rouge">-f name=redis.1 -f name=redis.7</code> returns both <code class="language-plaintext highlighter-rouge">redis.1</code> and <code class="language-plaintext highlighter-rouge">redis.7</code> tasks.</p> <p>The currently supported filters are:</p> <ul> <li><a href="#id">id</a></li> <li><a href="#name">name</a></li> <li><a href="#node">node</a></li> <li><a href="#desired-state">desired-state</a></li> </ul> <h4 id="id">id</h4> <p>The <code class="language-plaintext highlighter-rouge">id</code> filter matches on all or a prefix of a task’s ID.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps -f "id=8" redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+8ryt076polmc redis.4 redis:3.0.6 worker1 Running Running 9 seconds
+8eaxrb2fqpbn redis.10 redis:3.0.6 manager1 Running Running 8 seconds
+</pre></div> <h4 id="name">name</h4> <p>The <code class="language-plaintext highlighter-rouge">name</code> filter matches on task names.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps -f "name=redis.1" redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+qihejybwf1x5 redis.1 redis:3.0.6 manager1 Running Running 8 seconds
+</pre></div> <h4 id="node">node</h4> <p>The <code class="language-plaintext highlighter-rouge">node</code> filter matches on a node name or a node ID.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps -f "node=manager1" redis
+
+ID NAME IMAGE NODE DESIRED STATE CURRENT STATE ERROR PORTS
+0qihejybwf1x redis.1 redis:3.0.6 manager1 Running Running 8 seconds
+1x0v8yomsncd redis.5 redis:3.0.6 manager1 Running Running 8 seconds
+3w1wu13yupln redis.9 redis:3.0.6 manager1 Running Running 8 seconds
+8eaxrb2fqpbn redis.10 redis:3.0.6 manager1 Running Running 8 seconds
+</pre></div> <h4 id="desired-state">desired-state</h4> <p>The <code class="language-plaintext highlighter-rouge">desired-state</code> filter can take the values <code class="language-plaintext highlighter-rouge">running</code>, <code class="language-plaintext highlighter-rouge">shutdown</code>, or <code class="language-plaintext highlighter-rouge">accepted</code>.</p> <h3 id="formatting">Formatting</h3> <p>The formatting options (<code class="language-plaintext highlighter-rouge">--format</code>) pretty-prints tasks 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>Task ID</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Task name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Image</code></td> <td>Task image</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Node</code></td> <td>Node ID</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.DesiredState</code></td> <td>Desired state of the task (<code class="language-plaintext highlighter-rouge">running</code>, <code class="language-plaintext highlighter-rouge">shutdown</code>, or <code class="language-plaintext highlighter-rouge">accepted</code>)</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.CurrentState</code></td> <td>Current state of the task</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Error</code></td> <td>Error</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Ports</code></td> <td>Task published ports</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 ps</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">Name</code> and <code class="language-plaintext highlighter-rouge">Image</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all tasks:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker service ps --format "{{.Name}}: {{.Image}}" top
+
+top.1: busybox
+top.2: busybox
+top.3: busybox
+</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="../service_ls/index">docker service ls</a></td> <td>List services</td> </tr> <tr> <td><a href="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_ps/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/service_ps/</a>
+ </p>
+</div>