Signed-off-by: Sally O'Malley <somalley@redhat.com>
| ... | ... |
@@ -58,6 +58,8 @@ A Dockerfile is similar to a Makefile. |
| 58 | 58 |
|
| 59 | 59 |
`FROM image:tag` |
| 60 | 60 |
|
| 61 |
+ `FROM image@digest` |
|
| 62 |
+ |
|
| 61 | 63 |
-- The **FROM** instruction sets the base image for subsequent instructions. A |
| 62 | 64 |
valid Dockerfile must have **FROM** as its first instruction. The image can be any |
| 63 | 65 |
valid image. It is easy to start by pulling an image from the public |
| ... | ... |
@@ -72,8 +74,12 @@ A Dockerfile is similar to a Makefile. |
| 72 | 72 |
-- If no tag is given to the **FROM** instruction, Docker applies the |
| 73 | 73 |
`latest` tag. If the used tag does not exist, an error is returned. |
| 74 | 74 |
|
| 75 |
+ -- If no digest is given to the **FROM** instruction, Docker applies the |
|
| 76 |
+ `latest` tag. If the used tag does not exist, an error is returned. |
|
| 77 |
+ |
|
| 75 | 78 |
**MAINTAINER** |
| 76 | 79 |
-- **MAINTAINER** sets the Author field for the generated images. |
| 80 |
+ Useful for providing users with an email or url for support. |
|
| 77 | 81 |
|
| 78 | 82 |
**RUN** |
| 79 | 83 |
-- **RUN** has two forms: |
| ... | ... |
@@ -114,7 +120,7 @@ A Dockerfile is similar to a Makefile. |
| 114 | 114 |
CMD command param1 param2 |
| 115 | 115 |
``` |
| 116 | 116 |
|
| 117 |
- -- There can be only one **CMD** in a Dockerfile. If more than one **CMD** is listed, only |
|
| 117 |
+ -- There should be only one **CMD** in a Dockerfile. If more than one **CMD** is listed, only |
|
| 118 | 118 |
the last **CMD** takes effect. |
| 119 | 119 |
The main purpose of a **CMD** is to provide defaults for an executing container. |
| 120 | 120 |
These defaults may include an executable, or they can omit the executable. If |
| ... | ... |
@@ -150,13 +156,20 @@ A Dockerfile is similar to a Makefile. |
| 150 | 150 |
the image. |
| 151 | 151 |
|
| 152 | 152 |
**LABEL** |
| 153 |
- -- `LABEL <key>[=<value>] [<key>[=<value>] ...]` |
|
| 153 |
+ -- `LABEL <key>[=<value>] [<key>[=<value>] ...]`or |
|
| 154 |
+ ``` |
|
| 155 |
+ LABEL <key>[ <value>] |
|
| 156 |
+ LABEL <key>[ <value>] |
|
| 157 |
+ ... |
|
| 158 |
+ ``` |
|
| 154 | 159 |
The **LABEL** instruction adds metadata to an image. A **LABEL** is a |
| 155 | 160 |
key-value pair. To include spaces within a **LABEL** value, use quotes and |
| 156 | 161 |
backslashes as you would in command-line parsing. |
| 157 | 162 |
|
| 158 | 163 |
``` |
| 159 |
- LABEL "com.example.vendor"="ACME Incorporated" |
|
| 164 |
+ LABEL com.example.vendor="ACME Incorporated" |
|
| 165 |
+ or |
|
| 166 |
+ LABEL com.example.vendor "ACME Incorporated" |
|
| 160 | 167 |
``` |
| 161 | 168 |
|
| 162 | 169 |
An image can have more than one label. To specify multiple labels, separate |
| ... | ... |
@@ -179,7 +192,7 @@ A Dockerfile is similar to a Makefile. |
| 179 | 179 |
-- `ENV <key> <value>` |
| 180 | 180 |
The **ENV** instruction sets the environment variable <key> to |
| 181 | 181 |
the value `<value>`. This value is passed to all future |
| 182 |
- RUN, **ENTRYPOINT**, and **CMD** instructions. This is |
|
| 182 |
+ **RUN**, **ENTRYPOINT**, and **CMD** instructions. This is |
|
| 183 | 183 |
functionally equivalent to prefixing the command with `<key>=<value>`. The |
| 184 | 184 |
environment variables that are set with **ENV** persist when a container is run |
| 185 | 185 |
from the resulting image. Use `docker inspect` to inspect these values, and |
| ... | ... |
@@ -205,8 +218,11 @@ A Dockerfile is similar to a Makefile. |
| 205 | 205 |
then they must be relative to the source directory that is being built |
| 206 | 206 |
(the context of the build). The `<dest>` is the absolute path, or path relative |
| 207 | 207 |
to **WORKDIR**, into which the source is copied inside the target container. |
| 208 |
- All new files and directories are created with mode 0755 and with the uid |
|
| 209 |
- and gid of **0**. |
|
| 208 |
+ If the `<src>` argument is a local file in a recognized compression format |
|
| 209 |
+ (tar, gzip, bzip2, etc) then it is unpacked at the specified `<dest>` in the |
|
| 210 |
+ container's filesystem. Note that only local compressed files will be unpacked, |
|
| 211 |
+ i.e., the URL download and archive unpacking features cannot be used together. |
|
| 212 |
+ All new directories are created with mode 0755 and with the uid and gid of **0**. |
|
| 210 | 213 |
|
| 211 | 214 |
**COPY** |
| 212 | 215 |
-- **COPY** has two forms: |
| ... | ... |
@@ -223,8 +239,10 @@ A Dockerfile is similar to a Makefile. |
| 223 | 223 |
the path to a file or directory relative to the source directory that is |
| 224 | 224 |
being built (the context of the build) or a remote file URL. The `<dest>` is an |
| 225 | 225 |
absolute path, or a path relative to **WORKDIR**, into which the source will |
| 226 |
- be copied inside the target container. All new files and directories are |
|
| 227 |
- created with mode **0755** and with the uid and gid of **0**. |
|
| 226 |
+ be copied inside the target container. If you **COPY** an archive file it will |
|
| 227 |
+ land in the container exactly as it appears in the build context without any |
|
| 228 |
+ attempt to unpack it. All new files and directories are created with mode **0755** |
|
| 229 |
+ and with the uid and gid of **0**. |
|
| 228 | 230 |
|
| 229 | 231 |
**ENTRYPOINT** |
| 230 | 232 |
-- **ENTRYPOINT** has two forms: |
| ... | ... |
@@ -241,7 +259,7 @@ A Dockerfile is similar to a Makefile. |
| 241 | 241 |
container that can be run as an executable. When you specify an **ENTRYPOINT**, |
| 242 | 242 |
the whole container runs as if it was only that executable. The **ENTRYPOINT** |
| 243 | 243 |
instruction adds an entry command that is not overwritten when arguments are |
| 244 |
- passed to docker run. This is different from the behavior of CMD. This allows |
|
| 244 |
+ passed to docker run. This is different from the behavior of **CMD**. This allows |
|
| 245 | 245 |
arguments to be passed to the entrypoint, for instance `docker run <image> -d` |
| 246 | 246 |
passes the -d argument to the **ENTRYPOINT**. Specify parameters either in the |
| 247 | 247 |
**ENTRYPOINT** JSON array (as in the preferred exec form above), or by using a **CMD** |
| ... | ... |
@@ -327,3 +345,4 @@ A Dockerfile is similar to a Makefile. |
| 327 | 327 |
# HISTORY |
| 328 | 328 |
*May 2014, Compiled by Zac Dover (zdover at redhat dot com) based on docker.com Dockerfile documentation. |
| 329 | 329 |
*Feb 2015, updated by Brian Goff (cpuguy83@gmail.com) for readability |
| 330 |
+*Sept 2015, updated by Sally O'Malley (somalley@redhat.com) |