mirror of https://github.com/docker/cli.git
Add support for more advanced ${xxx:...} syntax
Just ${xxx:+...} and ${xxx:-...} for now Signed-off-by: Doug Davis <dug@us.ibm.com>
This commit is contained in:
parent
07995c4ef3
commit
efc478e33c
|
@ -113,18 +113,30 @@ images.
|
|||
> replacement at the time. After 1.3 this behavior will be preserved and
|
||||
> canonical.
|
||||
|
||||
Environment variables (declared with [the `ENV` statement](#env)) can also be used in
|
||||
certain instructions as variables to be interpreted by the `Dockerfile`. Escapes
|
||||
are also handled for including variable-like syntax into a statement literally.
|
||||
Environment variables (declared with [the `ENV` statement](#env)) can also be
|
||||
used in certain instructions as variables to be interpreted by the
|
||||
`Dockerfile`. Escapes are also handled for including variable-like syntax
|
||||
into a statement literally.
|
||||
|
||||
Environment variables are notated in the `Dockerfile` either with
|
||||
`$variable_name` or `${variable_name}`. They are treated equivalently and the
|
||||
brace syntax is typically used to address issues with variable names with no
|
||||
whitespace, like `${foo}_bar`.
|
||||
|
||||
The `${variable_name}` syntax also supports a few of the standard `bash`
|
||||
modifiers as specified below:
|
||||
|
||||
* `${variable:-word}` indicates that if `variable` is set then the result
|
||||
will be that value. If `variable` is not set then `word` will be the result.
|
||||
* `${variable:+word}` indiates that if `variable` is set then `word` will be
|
||||
the result, otherwise the result is the empty string.
|
||||
|
||||
In all cases, `word` can be any string, including additional environment
|
||||
variables.
|
||||
|
||||
Escaping is possible by adding a `\` before the variable: `\$foo` or `\${foo}`,
|
||||
for example, will translate to `$foo` and `${foo}` literals respectively.
|
||||
|
||||
|
||||
Example (parsed representation is displayed after the `#`):
|
||||
|
||||
FROM busybox
|
||||
|
|
Loading…
Reference in New Issue