github.com/khulnasoft/cli@v0.0.0-20240402070845-01bcad7beefa/docs/reference/commandline/config_ls.md (about)

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