From fastapi official doc The --no-cache-dir option tells pip to not save the downloaded packages locally, as that is only if pip was going to be run again to install the same packages, but that's not the case when working with containers. Basically, there is no need to store whatever package cache you're installing locally since it is not required by docker containers.