2016-10-27 20:30:32 -04:00
|
|
|
---
|
|
|
|
title: "secret ls"
|
|
|
|
description: "The secret ls command description and usage"
|
|
|
|
keywords: ["secret, ls"]
|
|
|
|
---
|
|
|
|
|
|
|
|
<!-- This file is maintained within the docker/docker Github
|
|
|
|
repository at https://github.com/docker/docker/. Make all
|
|
|
|
pull requests against that repo. If you see this file in
|
|
|
|
another repository, consider it read-only there, as it will
|
|
|
|
periodically be overwritten by the definitive file. Pull
|
|
|
|
requests which include edits to this file in other repositories
|
|
|
|
will be rejected.
|
|
|
|
-->
|
|
|
|
|
|
|
|
# secret ls
|
|
|
|
|
|
|
|
```Markdown
|
|
|
|
Usage: docker secret ls [OPTIONS]
|
|
|
|
|
|
|
|
List secrets
|
|
|
|
|
|
|
|
Aliases:
|
|
|
|
ls, list
|
|
|
|
|
|
|
|
Options:
|
|
|
|
-q, --quiet Only display IDs
|
2017-03-05 06:11:04 -05:00
|
|
|
-format string Pretty-print secrets using a Go template
|
2016-10-27 20:30:32 -04:00
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Description
|
|
|
|
|
2016-12-20 06:14:41 -05:00
|
|
|
Run this command on a manager node to list the secrets in the swarm.
|
2016-10-27 20:30:32 -04:00
|
|
|
|
2016-11-29 10:44:12 -05:00
|
|
|
## Examples
|
2016-10-27 20:30:32 -04:00
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker secret ls
|
2017-02-07 18:42:48 -05:00
|
|
|
|
2017-03-24 04:34:03 -04:00
|
|
|
ID NAME CREATED UPDATED
|
|
|
|
eo7jnzguqgtpdah3cm5srfb97 my_secret 11 minutes ago 11 minutes ago
|
2016-10-27 20:30:32 -04:00
|
|
|
```
|
2017-02-07 18:42:48 -05:00
|
|
|
|
2017-03-05 06:11:04 -05:00
|
|
|
### Format the output
|
|
|
|
|
|
|
|
The formatting option (`--format`) pretty prints secrets output
|
|
|
|
using a Go template.
|
|
|
|
|
|
|
|
Valid placeholders for the Go template are listed below:
|
|
|
|
|
|
|
|
| Placeholder | Description |
|
|
|
|
| ------------ | ------------------------------------------------------------------------------------ |
|
|
|
|
| `.ID` | Secret ID |
|
|
|
|
| `.Name` | Secret name |
|
|
|
|
| `.CreatedAt` | Time when the secret was created |
|
|
|
|
| `.UpdatedAt` | Time when the secret was updated |
|
|
|
|
| `.Labels` | All labels assigned to the secret |
|
|
|
|
| `.Label` | Value of a specific label for this secret. For example `{{.Label "secret.ssh.key"}}` |
|
|
|
|
|
|
|
|
When using the `--format` option, the `secret ls` command will either
|
|
|
|
output the data exactly as the template declares or, when using the
|
|
|
|
`table` directive, will include column headers as well.
|
|
|
|
|
|
|
|
The following example uses a template without headers and outputs the
|
|
|
|
`ID` and `Name` entries separated by a colon for all images:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker secret ls --format "{{.ID}}: {{.Name}}"
|
|
|
|
|
|
|
|
77af4d6b9913: secret-1
|
|
|
|
b6fa739cedf5: secret-2
|
|
|
|
78a85c484f71: secret-3
|
|
|
|
```
|
|
|
|
|
|
|
|
To list all secrets with their name and created date in a table format you
|
|
|
|
can use:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
$ docker secret ls --format "table {{.ID}}\t{{.Name}}\t{{.CreatedAt}}"
|
|
|
|
|
|
|
|
ID NAME CREATED
|
|
|
|
77af4d6b9913 secret-1 5 minutes ago
|
|
|
|
b6fa739cedf5 secret-2 3 hours ago
|
|
|
|
78a85c484f71 secret-3 10 days ago
|
|
|
|
```
|
|
|
|
|
2017-02-07 18:42:48 -05:00
|
|
|
## Related commands
|
2016-10-27 20:30:32 -04:00
|
|
|
|
|
|
|
* [secret create](secret_create.md)
|
|
|
|
* [secret inspect](secret_inspect.md)
|
|
|
|
* [secret rm](secret_rm.md)
|