support labels for secrets upon creation; review updates

Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
Evan Hazlett 2016-11-03 17:01:54 -04:00 коммит произвёл Tibor Vass
Родитель a5875e1a56
Коммит 6231e4899c
4 изменённых файлов: 45 добавлений и 11 удалений

Просмотреть файл

@ -19,6 +19,9 @@ keywords: ["secret, create"]
Usage: docker secret create [NAME]
Create a secret using stdin as content
Options:
--help Print usage
-l, --label list Secret labels (default [])
```
Creates a secret using standard input for the secret content. You must run this
@ -29,14 +32,45 @@ command on a manager node.
### Create a secret
```bash
$ cat ssh-dev | docker secret create ssh-dev
$ cat secret.json | docker secret create secret.json
mhv17xfe3gh6xc4rij5orpfds
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds ssh-dev 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
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
```
### Create a secret with labels
```bash
$ cat secret.json | docker secret create secret.json --label env=dev --label rev=20161102
jtn7g6aukl5ky7nr9gvwafoxh
$ docker secret inspect secret.json
[
{
"ID": "jtn7g6aukl5ky7nr9gvwafoxh",
"Version": {
"Index": 541
},
"CreatedAt": "2016-11-03T20:54:12.924766548Z",
"UpdatedAt": "2016-11-03T20:54:12.924766548Z",
"Spec": {
"Name": "secret.json",
"Labels": {
"env": "dev",
"rev": "20161102"
},
"Data": null
},
"Digest": "sha256:4212a44b14e94154359569333d3fc6a80f6b9959dfdaff26412f4b2796b1f387",
"SecretSize": 1679
}
]
```
## Related information
* [secret inspect](secret_inspect.md)

Просмотреть файл

@ -37,7 +37,7 @@ describes all the details of the format.
## Examples
### Inspecting a secret by name or ID
### Inspecting a secret by name or ID
You can inspect a secret, either by its *name*, or *ID*
@ -45,12 +45,12 @@ For example, given the following secret:
```bash
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds ssh-dev 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
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
```
```bash
$ docker secret inspect mhv17xfe3gh6xc4rij5orpfds
$ docker secret inspect secret.json
[
{
"ID": "mhv17xfe3gh6xc4rij5orpfds",
@ -60,7 +60,7 @@ $ docker secret inspect mhv17xfe3gh6xc4rij5orpfds
"CreatedAt": "2016-10-27T23:25:43.909181089Z",
"UpdatedAt": "2016-10-27T23:25:43.909181089Z",
"Spec": {
"Name": "ssh-dev",
"Name": "secret.json",
"Data": null
},
"Digest": "sha256:8281c6d924520986e3c6af23ed8926710a611c90339db582c2a9ac480ba622b7",

Просмотреть файл

@ -33,8 +33,8 @@ On a manager node:
```bash
$ docker secret ls
ID NAME CREATED UPDATED SIZE
mhv17xfe3gh6xc4rij5orpfds ssh-dev 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679
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
```
## Related information

Просмотреть файл

@ -33,7 +33,7 @@ targeting a manager node.
This example removes a secret:
```bash
$ docker secret rm sapth4csdo5b6wz2p5uimh5xg
$ docker secret rm secret.json
sapth4csdo5b6wz2p5uimh5xg
```