Dockerfiles unnecessarily large
tholiao opened this issue · 0 comments
tholiao commented
Dockerfiles have too many layers
Problem description:
Dockerfiles are unnecessarily long, i.e. too many layers during build and retain build artifacts
Problem example:
RUN apt-get -y install git make cmake unzip
RUN apt-get -y install libxrandr2 libxinerama-dev libxi6 libxcursor-dev
from rllab/docker/Dockerfile lines 27 and 33
Problem Implication:
unnecessarily large docker images -> harder to run multiple images on same machine
Solution description:
best practices recommend chaining / combining as many commands as possible to remove unnecessary layers
Solution example:
RUN apt-get update && apt-get install -y \
build-dep glfw \
libxrandr2 libxinerama-dev libxi6 libxcursor-dev \
&& rm -rf /var/lib/apt/lists/*