Digital Marketing

Run as many docker RUN commands as possible in the same layer

Shell Format
The shell format looks as follows:
RUN executable param1 param2

Exec Format
The exec format looks as follows:
RUN ["executable", "param1", "param2"]

The docker RUN command can use either of these forms. When running in shell form, a backslash must be used to continue the RUN instruction onto the next line. To reduce the number of layers produced it’s recommended to run as many RUN commands as possible in the same layer, for example like so:
RUN mkdir -p /opt/test/config && \
 mkdir -p /opt/test/lib

There is no functional reason to have a layer containing only one of these commands, so they are
merged to reduce layer complexity.

Comments

Popular posts from this blog

MySQL Sandbox with the Sakila sample database