A super fast on demand local PyPi mirror
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A super fast on demand local PyPi mirror

Target users / conditions

  • Company / Enterprise / Small team, members of which use Python and utlize pip for package management. Although there're lots of PyPi mirrors, the download speed is limited to the bandwidth, which brings unnecessary time when a same package been downloaded by multiple users, specially for some large packages.

  • When you use docker for building different Python-based application / environment, perhaps you would delete previous built image and test the Dockerfile over and over again. And adjust the commands in Dockerfile would also cause the cached intermediate container to be invalid. Re-downloading packages from PyPi (or its mirrors) takes unnecessary time.

More details


Please see this post on my blog.

Cache from?

The nginx configuration file overlay/etc/nginx/sites-available/default is configurated for caching https://pypi.tuna.tsinghua.edu.cn/simple, you may modify it if you prefer another PyPi repo.


  1. Get a domain name and its SSL certificates.
  2. Put the SSL certificate to overlay/cert/pypi.crt, and the private key to overlay/cert/pypi.key
sudo docker volume create pypicache
sudo docker build -t pip-cache ./
  1. Run
sudo docker run -d \
     -p 443:443 \
     --mount source=pypicache,target=/srv/pypicache/data \
     --name pypicache \
pip3 install -i https://pypi.yourdomain.com/simple anypackage