From 0cacd4bee2197e66105d960507f2ccac0f040263 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 20 May 2016 20:56:08 -0700 Subject: [PATCH] Docs: JSON vs Shell clarification Signed-off-by: John Howard --- docs/reference/builder.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index 49e33cc1c9..6ed7fe661c 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -362,6 +362,15 @@ RUN /bin/bash -c 'source $HOME/.bashrc ; echo $HOME' > `RUN [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`. > If you want shell processing then either use the *shell* form or execute > a shell directly, for example: `RUN [ "sh", "-c", "echo $HOME" ]`. +> +> **Note**: +> In the *JSON* form, it is necessary to escape backslashes. This is +> particularly relevant on Windows where the backslash is the path seperator. +> The following line would otherwise be treated as *shell* form due to not +> being valid JSON, and fail in an unexpected way: +> `RUN ["c:\windows\system32\tasklist.exe"]` +> The correct syntax for this example is: +> `RUN ["c:\\windows\\system32\\tasklist.exe"]` The cache for `RUN` instructions isn't invalidated automatically during the next build. The cache for an instruction like