Signed-off-by: Mary Anthony <mary@docker.com>
| ... | ... |
@@ -16,19 +16,19 @@ particular, when communicating over an untrusted medium such as the internet, it |
| 16 | 16 |
is critical to ensure the integrity and publisher of all the data a system |
| 17 | 17 |
operates on. You use Docker to push and pull images (data) to a registry. Content trust |
| 18 | 18 |
gives you the ability to both verify the integrity and the publisher of all the |
| 19 |
-data received from a registry over any channel. |
|
| 19 |
+data received from a registry over any channel. |
|
| 20 | 20 |
|
| 21 | 21 |
Content trust is currently only available for users of the public Docker Hub. It |
| 22 | 22 |
is currently not available for the Docker Trusted Registry or for private |
| 23 | 23 |
registries. |
| 24 | 24 |
|
| 25 |
-## Understand trust in Docker |
|
| 25 |
+## Understand trust in Docker |
|
| 26 | 26 |
|
| 27 | 27 |
Content trust allows operations with a remote Docker registry to enforce |
| 28 | 28 |
client-side signing and verification of image tags. Content trust provides the |
| 29 | 29 |
ability to use digital signatures for data sent to and received from remote |
| 30 | 30 |
Docker registries. These signatures allow client-side verification of the |
| 31 |
-integrity and publisher of specific image tags. |
|
| 31 |
+integrity and publisher of specific image tags. |
|
| 32 | 32 |
|
| 33 | 33 |
Currently, content trust is disabled by default. You must enabled it by setting |
| 34 | 34 |
the `DOCKER_CONTENT_TRUST` environment variable. |
| ... | ... |
@@ -36,7 +36,7 @@ the `DOCKER_CONTENT_TRUST` environment variable. |
| 36 | 36 |
Once content trust is enabled, image publishers can sign their images. Image consumers can |
| 37 | 37 |
ensure that the images they use are signed. publishers and consumers can be |
| 38 | 38 |
individuals alone or in organizations. Docker's content trust supports users and |
| 39 |
-automated processes such as builds. |
|
| 39 |
+automated processes such as builds. |
|
| 40 | 40 |
|
| 41 | 41 |
### Image tags and content trust |
| 42 | 42 |
|
| ... | ... |
@@ -48,7 +48,7 @@ An individual image record has the following identifier: |
| 48 | 48 |
|
| 49 | 49 |
A particular image `REPOSITORY` can have multiple tags. For example, `latest` and |
| 50 | 50 |
`3.1.2` are both tags on the `mongo` image. An image publisher can build an image |
| 51 |
- and tag combination many times changing the image with each build. |
|
| 51 |
+ and tag combination many times changing the image with each build. |
|
| 52 | 52 |
|
| 53 | 53 |
Content trust is associated with the `TAG` portion of an image. Each image |
| 54 | 54 |
repository has a set of keys that image publishers use to sign an image tag. |
| ... | ... |
@@ -67,7 +67,7 @@ Publishers can choose to sign a specific tag or not. As a result, the content of |
| 67 | 67 |
an unsigned tag and that of a signed tag with the same name may not match. For |
| 68 | 68 |
example, a publisher can push a tagged image `someimage:latest` and sign it. |
| 69 | 69 |
Later, the same publisher can push an unsigned `someimage:latest` image. This second |
| 70 |
-push replaces the last unsigned tag `latest` but does not affect the signed `latest` version. |
|
| 70 |
+push replaces the last unsigned tag `latest` but does not affect the signed `latest` version. |
|
| 71 | 71 |
The ability to choose which tags they can sign, allows publishers to iterate over |
| 72 | 72 |
the unsigned version of an image before officially signing it. |
| 73 | 73 |
|
| ... | ... |
@@ -92,9 +92,9 @@ operate with content trust are: |
| 92 | 92 |
|
| 93 | 93 |
* `push` |
| 94 | 94 |
* `build` |
| 95 |
-* `create` |
|
| 95 |
+* `create` |
|
| 96 | 96 |
* `pull` |
| 97 |
-* `run` |
|
| 97 |
+* `run` |
|
| 98 | 98 |
|
| 99 | 99 |
For example, with content trust enabled a `docker pull someimage:latest` only |
| 100 | 100 |
succeeds if `someimage:latest` is signed. However, an operation with an explicit |
| ... | ... |
@@ -105,7 +105,7 @@ $ docker pull someimage@sha256:d149ab53f8718e987c3a3024bb8aa0e2caadf6c0328f1d9d8 |
| 105 | 105 |
``` |
| 106 | 106 |
|
| 107 | 107 |
Trust for an image tag is managed through the use of signing keys. Docker's content |
| 108 |
-trust makes use four different keys: |
|
| 108 |
+trust makes use four different keys: |
|
| 109 | 109 |
|
| 110 | 110 |
| Key | Description | |
| 111 | 111 |
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| ... | ... |
@@ -126,25 +126,25 @@ The following image depicts the various signing keys and their relationships: |
| 126 | 126 |
>Correcting this loss requires intervention from [Docker |
| 127 | 127 |
>Support](https://support.docker.com) to reset the repository state. This loss |
| 128 | 128 |
>also requires **manual intervention** from every consumer that used a signed |
| 129 |
->tag from this repository prior to the loss. |
|
| 129 |
+>tag from this repository prior to the loss. |
|
| 130 | 130 |
|
| 131 | 131 |
You should backup the offline key somewhere safe. Given that it is only required |
| 132 | 132 |
to create new repositories, it is a good idea to store it offline. Make sure you |
| 133 | 133 |
read [Manage keys for content trust](/security/trust/trust_key_mng) information |
| 134 |
-for details on creating, securing, and backing up your keys. |
|
| 134 |
+for details on creating, securing, and backing up your keys. |
|
| 135 | 135 |
|
| 136 | 136 |
## Survey of typical content trust operations |
| 137 | 137 |
|
| 138 | 138 |
This section surveys the typical trusted operations users perform with Docker |
| 139 | 139 |
images. |
| 140 | 140 |
|
| 141 |
-### Enable content trust |
|
| 141 |
+### Enable and disable content trust per-shell or per-invocation |
|
| 142 | 142 |
|
| 143 |
-Enable content trust by setting the `DOCKER_CONTENT_TRUST` environment variable. |
|
| 144 |
-Enabling per-shell is useful because you can have one shell configured for |
|
| 145 |
-trusted operations and another terminal shell for untrusted operations. You can |
|
| 146 |
-also add this declaration to your shell profile to have it turned on always by |
|
| 147 |
-default. |
|
| 143 |
+In a shell, you can enable content trust by setting the `DOCKER_CONTENT_TRUST` |
|
| 144 |
+environment variable. Enabling per-shell is useful because you can have one |
|
| 145 |
+shell configured for trusted operations and another terminal shell for untrusted |
|
| 146 |
+operations. You can also add this declaration to your shell profile to have it |
|
| 147 |
+turned on always by default. |
|
| 148 | 148 |
|
| 149 | 149 |
To enable content trust in a `bash` shell enter the following command: |
| 150 | 150 |
|
| ... | ... |
@@ -152,23 +152,36 @@ To enable content trust in a `bash` shell enter the following command: |
| 152 | 152 |
export DOCKER_CONTENT_TRUST=1 |
| 153 | 153 |
``` |
| 154 | 154 |
|
| 155 |
-Once set, each of the "tag" operations require key for trusted tag. All of these |
|
| 156 |
-commands also support the `--disable-content-trust` flag. This flag allows |
|
| 157 |
-publishers to run individual operations on tagged images without content trust on an |
|
| 158 |
-as-needed basis. |
|
| 155 |
+Once set, each of the "tag" operations requires a key for a trusted tag. |
|
| 156 |
+ |
|
| 157 |
+In an environment where `DOCKER_CONTENT_TRUST` is set, you can use the |
|
| 158 |
+`--disable-content-trust` flag to run individual operations on tagged images |
|
| 159 |
+without content trust on an as-needed basis. |
|
| 160 |
+ |
|
| 161 |
+```bash |
|
| 162 |
+$ docker pull --disable-content-trust docker/trusttest:untrusted |
|
| 163 |
+``` |
|
| 164 |
+ |
|
| 165 |
+To invoke a command with content trust enabled regardless of whether or how the `DOCKER_CONTENT_TRUST` variable is set: |
|
| 166 |
+ |
|
| 167 |
+```bash |
|
| 168 |
+$ docker build --disable-content-trust=false -t docker/trusttest:testing . |
|
| 169 |
+``` |
|
| 170 |
+ |
|
| 171 |
+All of the trusted operations support the `--disable-content-trust` flag. |
|
| 159 | 172 |
|
| 160 | 173 |
|
| 161 | 174 |
### Push trusted content |
| 162 | 175 |
|
| 163 |
-To create signed content for a specific image tag, simply enable content trust and push |
|
| 164 |
-a tagged image. If this is the first time you have pushed an image using content trust |
|
| 165 |
-on your system, the session looks like this: |
|
| 176 |
+To create signed content for a specific image tag, simply enable content trust |
|
| 177 |
+and push a tagged image. If this is the first time you have pushed an image |
|
| 178 |
+using content trust on your system, the session looks like this: |
|
| 166 | 179 |
|
| 167 | 180 |
```bash |
| 168 | 181 |
$ docker push docker/trusttest:latest |
| 169 | 182 |
The push refers to a repository [docker.io/docker/trusttest] (len: 1) |
| 170 |
-9a61b6b1315e: Image already exists |
|
| 171 |
-902b87aaaec9: Image already exists |
|
| 183 |
+9a61b6b1315e: Image already exists |
|
| 184 |
+902b87aaaec9: Image already exists |
|
| 172 | 185 |
latest: digest: sha256:d02adacee0ac7a5be140adb94fa1dae64f4e71a68696e7f8e7cbf9db8dd49418 size: 3220 |
| 173 | 186 |
Signing and pushing trust metadata |
| 174 | 187 |
You are about to create a new offline signing key passphrase. This passphrase |
| ... | ... |
@@ -177,31 +190,31 @@ choose a long, complex passphrase and be careful to keep the password and the |
| 177 | 177 |
key file itself secure and backed up. It is highly recommended that you use a |
| 178 | 178 |
password manager to generate the passphrase and keep it safe. There will be no |
| 179 | 179 |
way to recover this key. You can find the key in your config directory. |
| 180 |
-Enter passphrase for new offline key with id a1d96fb: |
|
| 181 |
-Repeat passphrase for new offline key with id a1d96fb: |
|
| 182 |
-Enter passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1): |
|
| 183 |
-Repeat passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1): |
|
| 180 |
+Enter passphrase for new offline key with id a1d96fb: |
|
| 181 |
+Repeat passphrase for new offline key with id a1d96fb: |
|
| 182 |
+Enter passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1): |
|
| 183 |
+Repeat passphrase for new tagging key with id docker.io/docker/trusttest (3a932f1): |
|
| 184 | 184 |
Finished initializing "docker.io/docker/trusttest" |
| 185 | 185 |
``` |
| 186 |
-When you push your first tagged image with content trust enabled, the `docker` client |
|
| 187 |
-recognizes this is your first push and: |
|
| 188 |
- |
|
| 186 |
+When you push your first tagged image with content trust enabled, the `docker` |
|
| 187 |
+client recognizes this is your first push and: |
|
| 188 |
+ |
|
| 189 | 189 |
- alerts you that it will create a new offline key |
| 190 | 190 |
- requests a passphrase for the key |
| 191 | 191 |
- generates an offline key in the `~/.docker/trust` directory |
| 192 | 192 |
- generates a tagging key for in the `~/.docker/trust` directory |
| 193 |
- |
|
| 194 |
-The passphrase you chose for both the offline key and your content key-pair should |
|
| 195 |
-be randomly generated and stored in a *password manager*. |
|
| 196 | 193 |
|
| 197 |
-It is important to note, if you had left off the `latest` tag, content trust is skipped. |
|
| 198 |
-This is true even if content trust is enabled and even if this is your first push. |
|
| 194 |
+The passphrase you chose for both the offline key and your content key-pair |
|
| 195 |
+should be randomly generated and stored in a *password manager*. |
|
| 196 |
+ |
|
| 197 |
+> **NOTE**: If you omit the `latest` tag, content trust is skipped. This is true |
|
| 198 |
+even if content trust is enabled and even if this is your first push. |
|
| 199 | 199 |
|
| 200 | 200 |
```bash |
| 201 | 201 |
$ docker push docker/trusttest |
| 202 | 202 |
The push refers to a repository [docker.io/docker/trusttest] (len: 1) |
| 203 |
-9a61b6b1315e: Image successfully pushed |
|
| 204 |
-902b87aaaec9: Image successfully pushed |
|
| 203 |
+9a61b6b1315e: Image successfully pushed |
|
| 204 |
+902b87aaaec9: Image successfully pushed |
|
| 205 | 205 |
latest: digest: sha256:a9a9c4402604b703bed1c847f6d85faac97686e48c579bd9c3b0fa6694a398fc size: 3220 |
| 206 | 206 |
No tag specified, skipping trust metadata push |
| 207 | 207 |
``` |
| ... | ... |
@@ -215,13 +228,13 @@ you create can use that same offline key: |
| 215 | 215 |
```bash |
| 216 | 216 |
$ docker push docker.io/docker/seaside:latest |
| 217 | 217 |
The push refers to a repository [docker.io/docker/seaside] (len: 1) |
| 218 |
-a9539b34a6ab: Image successfully pushed |
|
| 219 |
-b3dbab3810fc: Image successfully pushed |
|
| 218 |
+a9539b34a6ab: Image successfully pushed |
|
| 219 |
+b3dbab3810fc: Image successfully pushed |
|
| 220 | 220 |
latest: digest: sha256:d2ba1e603661a59940bfad7072eba698b79a8b20ccbb4e3bfb6f9e367ea43939 size: 3346 |
| 221 | 221 |
Signing and pushing trust metadata |
| 222 |
-Enter key passphrase for offline key with id a1d96fb: |
|
| 223 |
-Enter passphrase for new tagging key with id docker.io/docker/seaside (bb045e3): |
|
| 224 |
-Repeat passphrase for new tagging key with id docker.io/docker/seaside (bb045e3): |
|
| 222 |
+Enter key passphrase for offline key with id a1d96fb: |
|
| 223 |
+Enter passphrase for new tagging key with id docker.io/docker/seaside (bb045e3): |
|
| 224 |
+Repeat passphrase for new tagging key with id docker.io/docker/seaside (bb045e3): |
|
| 225 | 225 |
Finished initializing "docker.io/docker/seaside" |
| 226 | 226 |
``` |
| 227 | 227 |
|
| ... | ... |
@@ -232,7 +245,7 @@ these. |
| 232 | 232 |
### Pull image content |
| 233 | 233 |
|
| 234 | 234 |
A common way to consume an image is to `pull` it. With content trust enabled, the Docker |
| 235 |
-client only allows `docker pull` to retrieve signed images. |
|
| 235 |
+client only allows `docker pull` to retrieve signed images. |
|
| 236 | 236 |
|
| 237 | 237 |
``` |
| 238 | 238 |
$ docker pull docker/seaside |
| ... | ... |
@@ -286,6 +299,3 @@ $ docker push --disable-content-trust docker/trusttest:untrusted |
| 286 | 286 |
* [Manage keys for content trust](/security/trust/trust_key_mng) |
| 287 | 287 |
* [Automation with content trust](/security/trust/trust_automation) |
| 288 | 288 |
* [Play in a content trust sandbox](/security/trust/trust_sandbox) |
| 289 |
- |
|
| 290 |
- |
|
| 291 |
- |