Browse code

Docs: JSON vs Shell clarification

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/05/21 12:56:08
Showing 1 changed files
... ...
@@ -362,6 +362,15 @@ RUN /bin/bash -c 'source $HOME/.bashrc ; echo $HOME'
362 362
 > `RUN [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
363 363
 > If you want shell processing then either use the *shell* form or execute
364 364
 > a shell directly, for example: `RUN [ "sh", "-c", "echo $HOME" ]`.
365
+>
366
+> **Note**:
367
+> In the *JSON* form, it is necessary to escape backslashes. This is
368
+> particularly relevant on Windows where the backslash is the path seperator.
369
+> The following line would otherwise be treated as *shell* form due to not
370
+> being valid JSON, and fail in an unexpected way:
371
+> `RUN ["c:\windows\system32\tasklist.exe"]`
372
+> The correct syntax for this example is:
373
+> `RUN ["c:\\windows\\system32\\tasklist.exe"]`
365 374
 
366 375
 The cache for `RUN` instructions isn't invalidated automatically during
367 376
 the next build. The cache for an instruction like