Pin versions in pip. Instead of
pip install <package>
use pip install <package>==<version>
or pip install --requirement <requirements file>
50 vim-common gasket-dkms
51
52# Install Required Python Packages and link python3 executable to python.
53RUN ln -s /usr/bin/python3 /usr/bin/python && \ 54 python -m pip install numpy opencv-python pyopengl
55
56# Set Timezone
Description
Version pinning forces the build to retrieve a particular version regardless of what’s in the cache. This technique can also reduce failures due to unanticipated changes in required packages. You can read more about version pinning here.
Bad Practice
FROM python:3.4
RUN pip install django
RUN pip install https://github.com/Banno/carbon/tarball/0.9.x-fix-events-callback
Recommended
FROM python:3.4
RUN pip install django==1.9
RUN pip install git+https://github.com/Banno/[email protected]
References
You can also specify the requirements in a text file and pass it to pip as shown here.