summaryrefslogtreecommitdiff
path: root/devdocs/docker/engine%2Freference%2Fcommandline%2Fconfig_create%2Findex.html
blob: 8ba5438ff5720ff2bb1b2424b6b58f88ab16a7df (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
49
50
51
<h1>docker config create</h1>  <p><br></p> <p>Create a config from a file or STDIN</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 create [OPTIONS] CONFIG file|-
</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">Creates a config using standard input or from a file for the config content.</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">--label</code> , <code class="language-plaintext highlighter-rouge">-l</code>
</td> <td></td> <td>Config labels</td> </tr> <tr> <td><code class="language-plaintext highlighter-rouge">--template-driver</code></td> <td></td> <td>Template driver</td> </tr>  </tbody> </table>  <h2 id="examples">Examples</h2> <h3 id="create-a-config">Create a config</h3> <div class="highlight"><pre class="highlight" data-language="">$ printf &lt;config&gt; | docker config create my_config -

onakdyv307se2tl7nl20anokv

$ docker config ls

ID                          NAME                CREATED             UPDATED
onakdyv307se2tl7nl20anokv   my_config           6 seconds ago       6 seconds ago
</pre></div> <h3 id="create-a-config-with-a-file">Create a config with a file</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker config create my_config ./config.json

dg426haahpi5ezmkkj5kyl3sn

$ docker config ls

ID                          NAME                CREATED             UPDATED
dg426haahpi5ezmkkj5kyl3sn   my_config           7 seconds ago       7 seconds ago
</pre></div> <h3 id="create-a-config-with-labels">Create a config with labels</h3> <div class="highlight"><pre class="highlight" data-language="">$ docker config create \
    --label env=dev \
    --label rev=20170324 \
    my_config ./config.json

eo7jnzguqgtpdah3cm5srfb97
</pre></div> <div class="highlight"><pre class="highlight" data-language="">$ docker config inspect my_config

[
    {
        "ID": "eo7jnzguqgtpdah3cm5srfb97",
        "Version": {
            "Index": 17
        },
        "CreatedAt": "2017-03-24T08:15:09.735271783Z",
        "UpdatedAt": "2017-03-24T08:15:09.735271783Z",
        "Spec": {
            "Name": "my_config",
            "Labels": {
                "env": "dev",
                "rev": "20170324"
            },
            "Data": "aGVsbG8K"
        }
    }
]
</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="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="../config_ls/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_create/" class="_attribution-link">https://docs.docker.com/engine/reference/commandline/config_create/</a>
  </p>
</div>