Instruction RUN
The RUN instruction executes the given command inside the build namespace.
# enable the foo service
RUN systemctl enable foo.service
Arguments are executed as-is, i.e. without shell expansion, redirection, piping, etc.
This ensures full control over the parsing of commands, but it also means normal shell syntax is not available:
# BROKEN: This will call "cat" with 3 arguments
RUN cat /etc/hostname "|" md5sum
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ this will not work
Instead, /bin/sh can be called explicitly:
# This will produce the md5sum of /etc/hostname
RUN /bin/sh -c "cat /etc/hostname | md5sum"