├── .gitignore ├── README.md └── docker-compose.yml /.gitignore: -------------------------------------------------------------------------------- 1 | .data* -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Instructions 3 | 4 | git clone https://github.com/techmaniack/docker-local-cache.git 5 | cd docker-local-cache 6 | docker-compose up -d 7 | 8 | Once the registry container is up and listening in port 5000 you must set the `registry-mirrors` key to `localhost:5000` and restart docker service. 9 | 10 | # Example 11 | First pull for mongo image takes 71 seconds while next pull is complete in 19 seconds. 12 | 13 | $ time docker pull mongo 14 | Using default tag: latest 15 | latest: Pulling from library/mongo 16 | ... 17 | Status: Downloaded newer image for mongo:latest 18 | docker pull mongo 0.17s user 0.07s system 0% cpu 1:11.08 total 19 | 20 | $ docker rmi mongo 21 | Untagged: mongo:latest 22 | Untagged: mongo@sha256:c4bc4644b967a4b58022a79cf5c9afcd25ed08180c958a74df57b7753cfc8649 23 | ... 24 | Deleted: sha256:5d924e3b1efdcda770bc33e6d7563f5ca2411dcc6b7368c8a30356bed474ae5a 25 | 26 | $ time docker pull mongo 27 | Using default tag: latest 28 | latest: Pulling from library/mongo 29 | ... 30 | Status: Downloaded newer image for mongo:latest 31 | docker pull mongo 0.13s user 0.05s system 0% cpu 19.296 total 32 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | services: 3 | registry2: 4 | image: registry:2 5 | ports: 6 | - 5000:5000 7 | environment: 8 | - REGISTRY_PROXY_REMOTEURL="https://registry-1.docker.io" 9 | volumes: 10 | - .data:/var/lib/registry 11 | --------------------------------------------------------------------------------