RUN
executes any commands on top of the current image and commits the results in a new layer. And committed image can be used for the next step in the Dockerfile
.
# This Command run in a shell form, default is /bin/sh -c on linux and cmd /S /C on Windows.
RUN <commands>
# This is in exec form
RUN ["executable", "param1", "param2"]
Run in shell form:
RUN /bin/bash -c "source $HOME/.bashrc; echo $HOME"
Using exec form:
RUN ["/bin/bash", "-c", "echo hello"]
Here, both shell and exec form run commands using /bin/bash
.