Each RUN command creates a new intermediate image container layer every time. We can avoid this by arranging all RUN command into single command.
Example: -
RUN apt-get update
RUN apt-get -y install httpd
RUN apt-get -y install curl
RUN apt-get -y install vim
This above command can be written in the structured way to reduce the number of layers.
RUN apt-get update \
&& apt-get -y install httpd \
&& apt-get -y install curl \
&& apt-get -y install vim