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

     1  # secret inspect
     2  
     3  <!---MARKER_GEN_START-->
     4  Display detailed information on one or more secrets
     5  
     6  ### Options
     7  
     8  | Name                                   | Type     | Default | Description                                                                                                                                                                                                                                                        |
     9  |:---------------------------------------|:---------|:--------|:-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
    10  | [`-f`](#format), [`--format`](#format) | `string` |         | Format output using a custom 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 |
    11  | `--pretty`                             |          |         | Print the information in a human friendly format                                                                                                                                                                                                                   |
    12  
    13  
    14  <!---MARKER_GEN_END-->
    15  
    16  ## Description
    17  
    18  Inspects the specified secret.
    19  
    20  By default, this renders all results in a JSON array. If a format is specified,
    21  the given template will be executed for each result.
    22  
    23  Go's [text/template](https://pkg.go.dev/text/template) package
    24  describes all the details of the format.
    25  
    26  For detailed information about using secrets, refer to [manage sensitive data with Docker secrets](https://docs.docker.com/engine/swarm/secrets/).
    27  
    28  > **Note**
    29  >
    30  > This is a cluster management command, and must be executed on a swarm
    31  > manager node. To learn about managers and workers, refer to the
    32  > [Swarm mode section](https://docs.docker.com/engine/swarm/) in the
    33  > documentation.
    34  
    35  ## Examples
    36  
    37  ### Inspect a secret by name or ID
    38  
    39  You can inspect a secret, either by its name or ID.
    40  
    41  For example, given the following secret:
    42  
    43  ```console
    44  $ docker secret ls
    45  
    46  ID                          NAME                CREATED             UPDATED
    47  eo7jnzguqgtpdah3cm5srfb97   my_secret           3 minutes ago       3 minutes ago
    48  ```
    49  
    50  ```console
    51  $ docker secret inspect secret.json
    52  ```
    53  
    54  The output is in JSON format, for example:
    55  
    56  ```json
    57  [
    58    {
    59      "ID": "eo7jnzguqgtpdah3cm5srfb97",
    60      "Version": {
    61        "Index": 17
    62      },
    63      "CreatedAt": "2017-03-24T08:15:09.735271783Z",
    64      "UpdatedAt": "2017-03-24T08:15:09.735271783Z",
    65      "Spec": {
    66        "Name": "my_secret",
    67        "Labels": {
    68          "env": "dev",
    69          "rev": "20170324"
    70        }
    71      }
    72    }
    73  ]
    74  ```
    75  
    76  ### <a name="format"></a> Format the output (--format)
    77  
    78  You can use the `--format` option to obtain specific information about a
    79  secret. The following example command outputs the creation time of the
    80  secret.
    81  
    82  ```console
    83  $ docker secret inspect --format='{{.CreatedAt}}' eo7jnzguqgtpdah3cm5srfb97
    84  
    85  2017-03-24 08:15:09.735271783 +0000 UTC
    86  ```
    87  
    88  
    89  ## Related commands
    90  
    91  * [secret create](secret_create.md)
    92  * [secret ls](secret_ls.md)
    93  * [secret rm](secret_rm.md)