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