Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

RUN mkdir -p /usr/src/ether \
    && curl -SL http://vacuum.com/huge.tar.xz \
    | tar -xJC /usr/src/ether \
    && make -C /usr/src/ether all

6.Chain commands together to reduce the number of layers 

A new container layer is created for every new instruction in the Dockerfile. Commands that are chained together become part of the same image layer.

To provide a good understanding of the content of each layer,  group related operations together so that they become part of a single layer.

Take for example:

RUN dnf install -y --setopt=tsflags=nodocs \

        httpd vim && \

        systemctl enable httpd && \

        dnf clean all

Each command associated with the installation and configuration of httpd is grouped and creates a single layer. Grouping operations this way reduces the number of layers and contributes to the legibility of the instructions.