From 66cf279f4cbbe63e5663d3c4122f1135e78740e6 Mon Sep 17 00:00:00 2001 From: Amen Belayneh Date: Sat, 12 Sep 2015 15:26:14 +0800 Subject: [PATCH 1/2] add a documentation note on backslash usage in shell form of RUN Signed-off-by: Amen Belayneh Upstream-commit: 6a55d953349eddaf502ff2db6c727e97a5dde3db Component: engine --- components/engine/docs/reference/builder.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/engine/docs/reference/builder.md b/components/engine/docs/reference/builder.md index 195139758f..5ce217b220 100644 --- a/components/engine/docs/reference/builder.md +++ b/components/engine/docs/reference/builder.md @@ -311,6 +311,12 @@ commands using a base image that does not contain `/bin/sh`. > If you want shell processing then either use the *shell* form or execute > a shell directly, for example: `RUN [ "sh", "-c", "echo", "$HOME" ]`. +> **Note**: +> If you choose to use the *shell* form, any time you want to continue a single +> `RUN` instruction onto the next line, it has to be ended with a backslash `\`. +> For example, `RUN /bin/bash -c 'source $HOME/.bashrc ;\` then on the next +> line ` echo $HOME '`. + The cache for `RUN` instructions isn't invalidated automatically during the next build. The cache for an instruction like `RUN apt-get dist-upgrade -y` will be reused during the next build. The From a212a2f5250ea236a5c1a7deb23f03848ec0833a Mon Sep 17 00:00:00 2001 From: Amen Belayneh Date: Mon, 14 Sep 2015 19:08:27 +0800 Subject: [PATCH 2/2] update documentation styling as per suggestions Signed-off-by: Amen Belayneh Upstream-commit: 30164588d6be5d5a07b079719f15cf2da06322d2 Component: engine --- components/engine/docs/reference/builder.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/engine/docs/reference/builder.md b/components/engine/docs/reference/builder.md index 5ce217b220..537cc98ece 100644 --- a/components/engine/docs/reference/builder.md +++ b/components/engine/docs/reference/builder.md @@ -295,6 +295,17 @@ any point in an image's history, much like source control. The *exec* form makes it possible to avoid shell string munging, and to `RUN` commands using a base image that does not contain `/bin/sh`. +In the *shell* form you can use a `\` (backslash) to continue a single +RUN instruction onto the next line. For example, consider these two lines: +``` +RUN /bin/bash -c 'source $HOME/.bashrc ;\ +echo $HOME' +``` +Together they are equivalent to this single line: +``` +RUN /bin/bash -c 'source $HOME/.bashrc ; echo $HOME' +``` + > **Note**: > To use a different shell, other than '/bin/sh', use the *exec* form > passing in the desired shell. For example, @@ -311,12 +322,6 @@ commands using a base image that does not contain `/bin/sh`. > If you want shell processing then either use the *shell* form or execute > a shell directly, for example: `RUN [ "sh", "-c", "echo", "$HOME" ]`. -> **Note**: -> If you choose to use the *shell* form, any time you want to continue a single -> `RUN` instruction onto the next line, it has to be ended with a backslash `\`. -> For example, `RUN /bin/bash -c 'source $HOME/.bashrc ;\` then on the next -> line ` echo $HOME '`. - The cache for `RUN` instructions isn't invalidated automatically during the next build. The cache for an instruction like `RUN apt-get dist-upgrade -y` will be reused during the next build. The