github.com/flavio/docker@v0.1.3-0.20170117145210-f63d1a6eec47/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 Creates a secret using standard input or from a file for the secret content. You must run this 29 command on a manager node. 30 31 ## Examples 32 33 ### Create a secret 34 35 ```bash 36 $ echo <secret> | docker secret create my_secret - 37 mhv17xfe3gh6xc4rij5orpfds 38 39 $ docker secret ls 40 ID NAME CREATED UPDATED SIZE 41 mhv17xfe3gh6xc4rij5orpfds my_secret 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679 42 ``` 43 44 ### Create a secret with a file 45 46 ```bash 47 $ docker secret create my_secret ./secret.json 48 mhv17xfe3gh6xc4rij5orpfds 49 50 $ docker secret ls 51 ID NAME CREATED UPDATED SIZE 52 mhv17xfe3gh6xc4rij5orpfds my_secret 2016-10-27 23:25:43.909181089 +0000 UTC 2016-10-27 23:25:43.909181089 +0000 UTC 1679 53 ``` 54 55 ### Create a secret with labels 56 57 ```bash 58 $ docker secret create --label env=dev --label rev=20161102 my_secret ./secret.json 59 jtn7g6aukl5ky7nr9gvwafoxh 60 61 $ docker secret inspect my_secret 62 [ 63 { 64 "ID": "jtn7g6aukl5ky7nr9gvwafoxh", 65 "Version": { 66 "Index": 541 67 }, 68 "CreatedAt": "2016-11-03T20:54:12.924766548Z", 69 "UpdatedAt": "2016-11-03T20:54:12.924766548Z", 70 "Spec": { 71 "Name": "my_secret", 72 "Labels": { 73 "env": "dev", 74 "rev": "20161102" 75 }, 76 "Data": null 77 }, 78 "Digest": "sha256:4212a44b14e94154359569333d3fc6a80f6b9959dfdaff26412f4b2796b1f387", 79 "SecretSize": 1679 80 } 81 ] 82 83 ``` 84 85 86 ## Related information 87 88 * [secret inspect](secret_inspect.md) 89 * [secret ls](secret_ls.md) 90 * [secret rm](secret_rm.md)