github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/docs/reference/commandline/config_create.md (about)

     1  ---
     2  title: "config create"
     3  description: "The config create command description and usage"
     4  keywords: ["config, create"]
     5  ---
     6  
     7  # config create
     8  
     9  ```Markdown
    10  Usage:  docker config create [OPTIONS] CONFIG [file|-]
    11  
    12  Create a config from a file or STDIN as content
    13  
    14  Options:
    15    -l, --label list               Config labels
    16        --template-driver string   Template driver
    17  ```
    18  
    19  ## Description
    20  
    21  Creates a config using standard input or from a file for the config content.
    22  
    23  For detailed information about using configs, refer to [store configuration data using Docker Configs](https://docs.docker.com/engine/swarm/configs/).
    24  
    25  > **Note**
    26  >
    27  > This is a cluster management command, and must be executed on a swarm
    28  > manager node. To learn about managers and workers, refer to the
    29  > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    30  > documentation.
    31  
    32  ## Examples
    33  
    34  ### Create a config
    35  
    36  ```console
    37  $ printf <config> | docker config create my_config -
    38  
    39  onakdyv307se2tl7nl20anokv
    40  
    41  $ docker config ls
    42  
    43  ID                          NAME                CREATED             UPDATED
    44  onakdyv307se2tl7nl20anokv   my_config           6 seconds ago       6 seconds ago
    45  ```
    46  
    47  ### Create a config with a file
    48  
    49  ```console
    50  $ docker config create my_config ./config.json
    51  
    52  dg426haahpi5ezmkkj5kyl3sn
    53  
    54  $ docker config ls
    55  
    56  ID                          NAME                CREATED             UPDATED
    57  dg426haahpi5ezmkkj5kyl3sn   my_config           7 seconds ago       7 seconds ago
    58  ```
    59  
    60  ### <a name="label"></a> Create a config with labels (-l, --label)
    61  
    62  ```console
    63  $ docker config create \
    64      --label env=dev \
    65      --label rev=20170324 \
    66      my_config ./config.json
    67  
    68  eo7jnzguqgtpdah3cm5srfb97
    69  ```
    70  
    71  ```console
    72  $ docker config inspect my_config
    73  
    74  [
    75      {
    76          "ID": "eo7jnzguqgtpdah3cm5srfb97",
    77          "Version": {
    78              "Index": 17
    79          },
    80          "CreatedAt": "2017-03-24T08:15:09.735271783Z",
    81          "UpdatedAt": "2017-03-24T08:15:09.735271783Z",
    82          "Spec": {
    83              "Name": "my_config",
    84              "Labels": {
    85                  "env": "dev",
    86                  "rev": "20170324"
    87              },
    88              "Data": "aGVsbG8K"
    89          }
    90      }
    91  ]
    92  ```
    93  
    94  
    95  ## Related commands
    96  
    97  * [config inspect](config_inspect.md)
    98  * [config ls](config_ls.md)
    99  * [config rm](config_rm.md)