ScanSkill

RUN

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.

Syntax

# 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"]

Example

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.