Merge pull request #814 from dnephin/fix-builder-env-docs

Improve builder ENV docs
This commit is contained in:
Sebastiaan van Stijn 2018-01-17 23:26:42 +01:00 committed by GitHub
commit 4f550018bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 6 deletions

View File

@ -805,14 +805,15 @@ see the
ENV <key>=<value> ... ENV <key>=<value> ...
The `ENV` instruction sets the environment variable `<key>` to the value The `ENV` instruction sets the environment variable `<key>` to the value
`<value>`. This value will be in the environment of all "descendant" `<value>`. This value will be in the environment for all subsequent instructions
`Dockerfile` commands and can be [replaced inline](#environment-replacement) in in the build stage and can be [replaced inline](#environment-replacement) in
many as well. many as well.
The `ENV` instruction has two forms. The first form, `ENV <key> <value>`, The `ENV` instruction has two forms. The first form, `ENV <key> <value>`,
will set a single variable to a value. The entire string after the first will set a single variable to a value. The entire string after the first
space will be treated as the `<value>` - including characters such as space will be treated as the `<value>` - including whitespace characters. The
spaces and quotes. value will be interpreted for other environment variables, so quote characters
will be removed if they are not escaped.
The second form, `ENV <key>=<value> ...`, allows for multiple variables to The second form, `ENV <key>=<value> ...`, allows for multiple variables to
be set at one time. Notice that the second form uses the equals sign (=) be set at one time. Notice that the second form uses the equals sign (=)
@ -830,8 +831,7 @@ and
ENV myDog Rex The Dog ENV myDog Rex The Dog
ENV myCat fluffy ENV myCat fluffy
will yield the same net results in the final image, but the first form will yield the same net results in the final image.
is preferred because it produces a single cache layer.
The environment variables set using `ENV` will persist when a container is run The environment variables set using `ENV` will persist when a container is run
from the resulting image. You can view the values using `docker inspect`, and from the resulting image. You can view the values using `docker inspect`, and