github.com/yogeshlonkar/moby@v1.13.2-0.20201203103638-c0b64beaea94/docs/reference/commandline/secret_inspect.md (about)

     1  ---
     2  title: "secret inspect"
     3  description: "The secret inspect command description and usage"
     4  keywords: ["secret, inspect"]
     5  ---
     6  
     7  <!-- This file is maintained within the docker/docker Github
     8       repository at https://github.com/docker/docker/. Make all
     9       pull requests against that repo. If you see this file in
    10       another repository, consider it read-only there, as it will
    11       periodically be overwritten by the definitive file. Pull
    12       requests which include edits to this file in other repositories
    13       will be rejected.
    14  -->
    15  
    16  # secret inspect
    17  
    18  ```Markdown
    19  Usage:  docker secret inspect [OPTIONS] SECRET [SECRET...]
    20  
    21  Display detailed information on one or more secrets
    22  
    23  Options:
    24    -f, --format string   Format the output using the given Go template
    25        --help            Print usage
    26  ```
    27  
    28  ## Description
    29  
    30  Inspects the specified secret. This command has to be run targeting a manager
    31  node.
    32  
    33  By default, this renders all results in a JSON array. If a format is specified,
    34  the given template will be executed for each result.
    35  
    36  Go's [text/template](http://golang.org/pkg/text/template/) package
    37  describes all the details of the format.
    38  
    39  For detailed information about using secrets, refer to [manage sensitive data with Docker secrets](https://docs.docker.com/engine/swarm/secrets/).
    40  
    41  ## Examples
    42  
    43  ### Inspect a secret by name or ID
    44  
    45  You can inspect a secret, either by its *name*, or *ID*
    46  
    47  For example, given the following secret:
    48  
    49  ```bash
    50  $ docker secret ls
    51  ID                          NAME                    CREATED                                   UPDATED
    52  mhv17xfe3gh6xc4rij5orpfds   secret.json             2016-10-27 23:25:43.909181089 +0000 UTC   2016-10-27 23:25:43.909181089 +0000 UTC
    53  ```
    54  
    55  ```none
    56  $ docker secret inspect secret.json
    57  
    58  [
    59      {
    60          "ID": "mhv17xfe3gh6xc4rij5orpfds",
    61              "Version": {
    62              "Index": 1198
    63          },
    64          "CreatedAt": "2016-10-27T23:25:43.909181089Z",
    65          "UpdatedAt": "2016-10-27T23:25:43.909181089Z",
    66          "Spec": {
    67              "Name": "secret.json"
    68          }
    69      }
    70  ]
    71  ```
    72  
    73  ### Formatting
    74  
    75  You can use the --format option to obtain specific information about a
    76  secret. The following example command outputs the creation time of the
    77  secret.
    78  
    79  ```bash
    80  $ docker secret inspect --format='{{.CreatedAt}}' mhv17xfe3gh6xc4rij5orpfds
    81  
    82  2016-10-27 23:25:43.909181089 +0000 UTC
    83  ```
    84  
    85  
    86  ## Related commands
    87  
    88  * [secret create](secret_create.md)
    89  * [secret ls](secret_ls.md)
    90  * [secret rm](secret_rm.md)