github.com/fabiokung/docker@v0.11.2-0.20170222101415-4534dcd49497/docs/reference/commandline/secret_create.md (about) 1 --- 2 title: "secret create" 3 description: "The secret create command description and usage" 4 keywords: ["secret, create"] 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 create 17 18 ```Markdown 19 Usage: docker secret create [OPTIONS] SECRET file|- 20 21 Create a secret from a file or STDIN as content 22 23 Options: 24 --help Print usage 25 -l, --label list Secret labels (default []) 26 ``` 27 28 ## Description 29 30 Creates a secret using standard input or from a file for the secret content. You must run this 31 command on a manager node. 32 33 ## Examples 34 35 ### Create a secret 36 37 ```bash 38 $ echo <secret> | docker secret create my_secret - 39 mhv17xfe3gh6xc4rij5orpfds 40 41 $ docker secret ls 42 ID NAME CREATED UPDATED SIZE 43 mhv17xfe3gh6xc4rij5orpfds my_secret 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679 44 ``` 45 46 ### Create a secret with a file 47 48 ```bash 49 $ docker secret create my_secret ./secret.json 50 51 mhv17xfe3gh6xc4rij5orpfds 52 53 $ docker secret ls 54 55 ID NAME CREATED UPDATED SIZE 56 mhv17xfe3gh6xc4rij5orpfds my_secret 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679 57 ``` 58 59 ### Create a secret with labels 60 61 ```bash 62 $ docker secret create --label env=dev \ 63 --label rev=20161102 \ 64 my_secret ./secret.json 65 66 jtn7g6aukl5ky7nr9gvwafoxh 67 ``` 68 69 ```none 70 $ docker secret inspect my_secret 71 72 [ 73 { 74 "ID": "jtn7g6aukl5ky7nr9gvwafoxh", 75 "Version": { 76 "Index": 541 77 }, 78 "CreatedAt": "2016-11-03T20:54:12.924766548Z", 79 "UpdatedAt": "2016-11-03T20:54:12.924766548Z", 80 "Spec": { 81 "Name": "my_secret", 82 "Labels": { 83 "env": "dev", 84 "rev": "20161102" 85 }, 86 "Data": null 87 }, 88 "Digest": "sha256:4212a44b14e94154359569333d3fc6a80f6b9959dfdaff26412f4b2796b1f387", 89 "SecretSize": 1679 90 } 91 ] 92 ``` 93 94 95 ## Related commands 96 97 * [secret inspect](secret_inspect.md) 98 * [secret ls](secret_ls.md) 99 * [secret rm](secret_rm.md)