Skip to content

Commit

Permalink
docs/builder: add note about handling of leading whitespace
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jul 1, 2020
1 parent 1c6dd42 commit 5413f31
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions docs/reference/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,34 @@ RUN echo 'we are running some # of cool things'

Line continuation characters are not supported in comments.

> **Note on whitespace**
>
> For backward compatibility, leading whitespace before comments (`#`) and
> instructions are ignored, but not recommended. The leading whitespace is not
> preserved, and the following examples are therefore equivalent:
>
> ```dockerfile
> # this is a comment-line
> RUN echo hello
> RUN echo world
> ```
>
> ```dockerfile
> # this is a comment-line
> RUN echo hello
> RUN echo world
> ```
>
> However, whitespace in instruction arguments, such as `RUN` are always preserved,
> so the following example prints ` hello world` with leading whitespace as
> specified:
>
> ```dockerfile
> RUN echo "\
> hello\
> world"
> ```
## Parser directives
Parser directives are optional, and affect the way in which subsequent lines
Expand Down

0 comments on commit 5413f31

Please sign in to comment.