Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Hong Xu edited this page Jun 22, 2021 · 5 revisions

Avoid cache directory with pip install --no-cache-dir <package>

Problematic code:

RUN pip3 install MySQL_python

Correct code:

RUN pip3 install --no-cache-dir MySQL_python

Rationale:

Once a package is installed, it does not need to be re-installed and the Docker cache can be leveraged instead. Since the pip cache makes the images larger and is not needed, it's better to disable it.

Clone this wiki locally