For the below "shell" form of RUN instruction, what would be the "exec" form?
RUN echo `uname -rv` > $HOME/kernel-info
I tried below, its giving the error, cat: can't open '/root/kernel-info': No such file or directory
RUN ["echo","uname", "-rv", ">", "$HOME","/kernel-info" ]
CodePudding user response:
You're using output redirection and environment variable substitution which are both done by the shell. So you need a shell to run. If you prefer the exec form, you need to run the shell yourself, like this
RUN [ "/bin/sh", "-c", "echo `uname -rv` > $HOME/kernel-info" ]
CodePudding user response:
To use a different shell, other than /bin/sh
, use the exec form passing in the desired shell. For example:
RUN ["/bin/bash", "-c", "echo hello"]