github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/cli/docs/reference/commandline/config_ls.md (about) 1 --- 2 title: "config ls" 3 description: "The config ls command description and usage" 4 keywords: ["config, ls"] 5 --- 6 7 # config ls 8 9 ```Markdown 10 Usage: docker config ls [OPTIONS] 11 12 List configs 13 14 Aliases: 15 ls, list 16 17 Options: 18 -f, --filter filter Filter output based on conditions provided 19 --format string Pretty-print configs using a Go template 20 --help Print usage 21 -q, --quiet Only display IDs 22 ``` 23 24 ## Description 25 26 Run this command on a manager node to list the configs in the swarm. 27 28 For detailed information about using configs, refer to [store configuration data using Docker Configs](https://docs.docker.com/engine/swarm/configs/). 29 30 > **Note** 31 > 32 > This is a cluster management command, and must be executed on a swarm 33 > manager node. To learn about managers and workers, refer to the 34 > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the 35 > documentation. 36 37 ## Examples 38 39 ```console 40 $ docker config ls 41 42 ID NAME CREATED UPDATED 43 6697bflskwj1998km1gnnjr38 q5s5570vtvnimefos1fyeo2u2 6 weeks ago 6 weeks ago 44 9u9hk4br2ej0wgngkga6rp4hq my_config 5 weeks ago 5 weeks ago 45 mem02h8n73mybpgqjf0kfi1n0 test_config 3 seconds ago 3 seconds ago 46 ``` 47 48 ### <a name="filter"></a> Filtering (-f, --filter) 49 50 The filtering flag (`-f` or `--filter`) format is a `key=value` pair. If there is more 51 than one filter, then pass multiple flags (e.g., `--filter "foo=bar" --filter "bif=baz"`) 52 53 The currently supported filters are: 54 55 - [id](#id) (config's ID) 56 - [label](#label) (`label=<key>` or `label=<key>=<value>`) 57 - [name](#name) (config's name) 58 59 #### id 60 61 The `id` filter matches all or prefix of a config's id. 62 63 ```console 64 $ docker config ls -f "id=6697bflskwj1998km1gnnjr38" 65 66 ID NAME CREATED UPDATED 67 6697bflskwj1998km1gnnjr38 q5s5570vtvnimefos1fyeo2u2 6 weeks ago 6 weeks ago 68 ``` 69 70 #### label 71 72 The `label` filter matches configs based on the presence of a `label` alone or 73 a `label` and a value. 74 75 The following filter matches all configs with a `project` label regardless of 76 its value: 77 78 ```console 79 $ docker config ls --filter label=project 80 81 ID NAME CREATED UPDATED 82 mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago 83 ``` 84 85 The following filter matches only services with the `project` label with the 86 `project-a` value. 87 88 ```console 89 $ docker service ls --filter label=project=test 90 91 ID NAME CREATED UPDATED 92 mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago 93 ``` 94 95 #### name 96 97 The `name` filter matches on all or prefix of a config's name. 98 99 The following filter matches config with a name containing a prefix of `test`. 100 101 ```console 102 $ docker config ls --filter name=test_config 103 104 ID NAME CREATED UPDATED 105 mem02h8n73mybpgqjf0kfi1n0 test_config About an hour ago About an hour ago 106 ``` 107 108 ### <a name="format"></a> Format the output (--format) 109 110 The formatting option (`--format`) pretty prints configs output 111 using a Go template. 112 113 Valid placeholders for the Go template are listed below: 114 115 | Placeholder | Description | 116 |--------------|--------------------------------------------------------------------------------------| 117 | `.ID` | Config ID | 118 | `.Name` | Config name | 119 | `.CreatedAt` | Time when the config was created | 120 | `.UpdatedAt` | Time when the config was updated | 121 | `.Labels` | All labels assigned to the config | 122 | `.Label` | Value of a specific label for this config. For example `{{.Label "my-label"}}` | 123 124 When using the `--format` option, the `config ls` command will either 125 output the data exactly as the template declares or, when using the 126 `table` directive, will include column headers as well. 127 128 The following example uses a template without headers and outputs the 129 `ID` and `Name` entries separated by a colon (`:`) for all images: 130 131 ```console 132 $ docker config ls --format "{{.ID}}: {{.Name}}" 133 134 77af4d6b9913: config-1 135 b6fa739cedf5: config-2 136 78a85c484f71: config-3 137 ``` 138 139 To list all configs with their name and created date in a table format you 140 can use: 141 142 ```console 143 $ docker config ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}" 144 145 ID NAME CREATED 146 77af4d6b9913 config-1 5 minutes ago 147 b6fa739cedf5 config-2 3 hours ago 148 78a85c484f71 config-3 10 days ago 149 ``` 150 151 ## Related commands 152 153 * [config create](config_create.md) 154 * [config inspect](config_inspect.md) 155 * [config rm](config_rm.md)