Browse code

Fix error for env variables example in docker reference - 2 The reason why the issue occurs is because sh parses the first argument after -c as the whole script to execute. Everything after isn't executed as one might expect.

When working on the 'fix' I found out the same fix is also done in commit 2af7c5cfe24b4c8e931f751979b5e69e20ba77e2, except only for one occurrence.

Signed-off-by: Serhat Gülçiçek <serhat+signoff@equil.nl>
(cherry picked from commit 7a30fa7af6f0bb3850ce6167850642420b4c0633)

Serhat Gülçiçek authored on 2016/06/20 19:35:26
Showing 1 changed files
... ...
@@ -606,7 +606,7 @@ instruction as well.
606 606
 > This means that normal shell processing does not happen. For example,
607 607
 > `CMD [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
608 608
 > If you want shell processing then either use the *shell* form or execute
609
-> a shell directly, for example: `CMD [ "sh", "-c", "echo", "$HOME" ]`.
609
+> a shell directly, for example: `CMD [ "sh", "-c", "echo $HOME" ]`.
610 610
 
611 611
 When used in the shell or exec formats, the `CMD` instruction sets the command
612 612
 to be executed when running the image.
... ...
@@ -1074,7 +1074,7 @@ sys	0m 0.03s
1074 1074
 > This means that normal shell processing does not happen. For example,
1075 1075
 > `ENTRYPOINT [ "echo", "$HOME" ]` will not do variable substitution on `$HOME`.
1076 1076
 > If you want shell processing then either use the *shell* form or execute
1077
-> a shell directly, for example: `ENTRYPOINT [ "sh", "-c", "echo", "$HOME" ]`.
1077
+> a shell directly, for example: `ENTRYPOINT [ "sh", "-c", "echo $HOME" ]`.
1078 1078
 > Variables that are defined in the `Dockerfile`using `ENV`, will be substituted by
1079 1079
 > the `Dockerfile` parser.
1080 1080