summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fconfig_ls%2Findex.html
blob: 4715cbcbbf654e2b854cc881a524b8989d11246b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<h1>docker config ls</h1>  <p><br></p> <p>List configs</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 config 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">Run this command on a manager node to list the configs in the swarm.</p> <p>For detailed information about using configs, refer to <a href="../../../swarm/configs/index">store configuration data using Docker Configs</a>.</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 configs 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> <div class="highlight"><pre class="highlight" data-language="">$ docker config ls

ID                          NAME                        CREATED             UPDATED
6697bflskwj1998km1gnnjr38   q5s5570vtvnimefos1fyeo2u2   6 weeks ago         6 weeks ago
9u9hk4br2ej0wgngkga6rp4hq   my_config                   5 weeks ago         5 weeks ago
mem02h8n73mybpgqjf0kfi1n0   test_config                 3 seconds ago       3 seconds ago
</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>)</p> <p>The currently supported filters are:</p> <ul> <li>
<a href="#id">id</a> (config’s ID)</li> <li>
<a href="#label">label</a> (<code class="language-plaintext highlighter-rouge">label=&lt;key&gt;</code> or <code class="language-plaintext highlighter-rouge">label=&lt;key&gt;=&lt;value&gt;</code>)</li> <li>
<a href="#name">name</a> (config’s name)</li> </ul> <h4 id="id">id</h4> <p>The <code class="language-plaintext highlighter-rouge">id</code> filter matches all or prefix of a config’s id.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker config ls -f "id=6697bflskwj1998km1gnnjr38"

ID                          NAME                        CREATED             UPDATED
6697bflskwj1998km1gnnjr38   q5s5570vtvnimefos1fyeo2u2   6 weeks ago         6 weeks ago
</pre></div> <h4 id="label">label</h4> <p>The <code class="language-plaintext highlighter-rouge">label</code> filter matches configs 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 configs 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 config ls --filter label=project

ID                          NAME                        CREATED             UPDATED
mem02h8n73mybpgqjf0kfi1n0   test_config                 About an hour ago   About an hour ago
</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=test

ID                          NAME                        CREATED             UPDATED
mem02h8n73mybpgqjf0kfi1n0   test_config                 About an hour ago   About an hour ago
</pre></div> <h4 id="name">name</h4> <p>The <code class="language-plaintext highlighter-rouge">name</code> filter matches on all or prefix of a config’s name.</p> <p>The following filter matches config with a name containing a prefix of <code class="language-plaintext highlighter-rouge">test</code>.</p> <div class="highlight"><pre class="highlight" data-language="">$ docker config ls --filter name=test_config

ID                          NAME                        CREATED             UPDATED
mem02h8n73mybpgqjf0kfi1n0   test_config                 About an hour ago   About an hour ago
</pre></div> <h3 id="format-the-output">Format the output</h3> <p>The formatting option (<code class="language-plaintext highlighter-rouge">--format</code>) pretty prints configs 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>Config ID</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Name</code></td> <td>Config name</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.CreatedAt</code></td> <td>Time when the config was created</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.UpdatedAt</code></td> <td>Time when the config was updated</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Labels</code></td> <td>All labels assigned to the config</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">.Label</code></td> <td>Value of a specific label for this config. For example <code class="language-plaintext highlighter-rouge">{{.Label "my-label"}}</code>
</td> </tr> </tbody> </table> <p>When using the <code class="language-plaintext highlighter-rouge">--format</code> option, the <code class="language-plaintext highlighter-rouge">config 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, will include 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> and <code class="language-plaintext highlighter-rouge">Name</code> entries separated by a colon (<code class="language-plaintext highlighter-rouge">:</code>) for all images:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker config ls --format "{{.ID}}: {{.Name}}"

77af4d6b9913: config-1
b6fa739cedf5: config-2
78a85c484f71: config-3
</pre></div> <p>To list all configs with their name and created date in a table format you can use:</p> <div class="highlight"><pre class="highlight" data-language="">$ docker config ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"

ID                  NAME                      CREATED
77af4d6b9913        config-1                  5 minutes ago
b6fa739cedf5        config-2                  3 hours ago
78a85c484f71        config-3                  10 days ago
</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="../config/index">docker config</a></td> <td style="text-align: left">Manage Docker configs</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="../config_create/index">docker config create</a></td> <td>Create a config from a file or STDIN</td> </tr> <tr> <td><a href="../config_inspect/index">docker config inspect</a></td> <td>Display detailed information on one or more configs</td> </tr> <tr> <td><a href="index">docker config ls</a></td> <td>List configs</td> </tr> <tr> <td><a href="../config_rm/index">docker config rm</a></td> <td>Remove one or more configs</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/config_ls/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/config_ls/</a>
  </p>
</div>