mirror of https://github.com/docker/cli.git
2.5 KiB
2.5 KiB
title | description | keywords | |
---|---|---|---|
secret inspect | The secret inspect command description and usage |
|
secret inspect
Usage: docker secret inspect [OPTIONS] SECRET [SECRET...]
Display detailed information on one or more secrets
Options:
-f, --format string Format the output using the given Go template
--help Print usage
Inspects the specified secret. This command has to be run targeting a manager node.
By default, this renders all results in a JSON array. If a format is specified, the given template will be executed for each result.
Go's text/template package describes all the details of the format.
Examples
Inspecting a secret by name or ID
You can inspect a secret, either by its name, or ID
For example, given the following secret:
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds secret.json 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
$ docker secret inspect secret.json
[
{
"ID": "mhv17xfe3gh6xc4rij5orpfds",
"Version": {
"Index": 1198
},
"CreatedAt": "2016-10-27T23:25:43.909181089Z",
"UpdatedAt": "2016-10-27T23:25:43.909181089Z",
"Spec": {
"Name": "secret.json",
"Data": null
},
"Digest": "sha256:8281c6d924520986e3c6af23ed8926710a611c90339db582c2a9ac480ba622b7",
"SecretSize": 1679
}
]
Formatting secret output
You can use the --format option to obtain specific information about a secret. The following example command outputs the digest of the secret.
$ docker secret inspect --format='{{.Digest}}' mhv17xfe3gh6xc4rij5orpfds
sha256:8281c6d924520986e3c6af23ed8926710a611c90339db582c2a9ac480ba622b7
{% endraw %}```
## Related information
* [secret create](secret_create.md)
* [secret ls](secret_ls.md)
* [secret rm](secret_rm.md)