From f44d78b47838204b85204711d014b7f4cf7826ec Mon Sep 17 00:00:00 2001 From: David Dooling Date: Tue, 16 Aug 2016 15:01:05 -0500 Subject: [PATCH 1/2] Remove erroneous ENTRYPOINT note The Dockerfile parser does not subsitute ENV variables in any form of the ENTRYPOINT command. Any substitution, if done, is done by the shell when the command is executed. Signed-off-by: David Dooling --- docs/reference/builder.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index 5975110fe4..1868122a04 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -1075,8 +1075,6 @@ sys 0m 0.03s > `ENTRYPOINT [ "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: `ENTRYPOINT [ "sh", "-c", "echo $HOME" ]`. -> Variables that are defined in the `Dockerfile`using `ENV`, will be substituted by -> the `Dockerfile` parser. ### Shell form ENTRYPOINT example From 20e336efac147f7cc565eeb4c68beb6ccf905e50 Mon Sep 17 00:00:00 2001 From: David Dooling Date: Wed, 17 Aug 2016 06:31:19 -0500 Subject: [PATCH 2/2] Make it clear who is doing variable expansion Add sentece to RUN, CMD, and ENTRYPOINT exec sections making it clear that it is the shell doing the environment variable expansion. Signed-off-by: David Dooling --- docs/reference/builder.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index 1868122a04..15bfd9a295 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -541,6 +541,9 @@ 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" ]`. +> When using the exec form and executing a shell directly, as in the case for +> the shell form, it is the shell that is doing the environment variable +> expansion, not docker. > > **Note**: > In the *JSON* form, it is necessary to escape backslashes. This is @@ -607,6 +610,9 @@ instruction as well. > `CMD [ "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: `CMD [ "sh", "-c", "echo $HOME" ]`. +> When using the exec form and executing a shell directly, as in the case for +> the shell form, it is the shell that is doing the environment variable +> expansion, not docker. When used in the shell or exec formats, the `CMD` instruction sets the command to be executed when running the image. @@ -1075,6 +1081,9 @@ sys 0m 0.03s > `ENTRYPOINT [ "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: `ENTRYPOINT [ "sh", "-c", "echo $HOME" ]`. +> When using the exec form and executing a shell directly, as in the case for +> the shell form, it is the shell that is doing the environment variable +> expansion, not docker. ### Shell form ENTRYPOINT example