What is pip's `--no-cache-dir` good for?

后端 未结 5 673
清酒与你
清酒与你 2021-01-30 07:55

I\'ve recently seen the --no-cache-dir being used in a Docker file. I\'ve never seen that flag before and the help is not explaining it:

 --no-cache         


        
5条回答
  •  礼貌的吻别
    2021-01-30 08:33

    Another reason to disable the pip cache - if you run pip as a user that does not yet exist, their home directory will be created, but owned by root.

    This happens to us when building Amazon AMIs in a chroot - pip is being run as a user that exists on the builder machine, but not in the chroot jail where the AMI is being constructed. This is problematic as that specific user can now not ssh to what was just built as their .ssh directory is not readable by them.

    I can't think of any other reason pip would be run as a user that doesn't exist though, so it's very much an edge case.

提交回复
热议问题