I’ve always been wondering how Docker works in this regards, and whether I should either make as many “RUN apt-get install” commands as possible, or if I should instead try to use as few RUN commands as possible, as these increases the number of layers (?).
So for example:
RUN apt-get update && apt-get install -y \
python-qt4 \
python-pyside \
python-pip \
python3-pip \
python3-pyqt5
…versus:
RUN apt-get update
RUN apt-get install -y python-qt4
RUN apt-get install -y python-pyside
RUN apt-get install -y python-pip
RUN apt-get install -y python3-pip
RUN apt-get install -y python3-pyqt5
Is there any reason to prefer either of these approaches when setting up a Dockerfile, building an image and pushing that to Dockerhub?