Docker pulls cache for private registry, not working

I tried pulling out a docker cache released in registry 2.1.1 using docker 1.8. on CentOS7.1 However, I have been following these websites and it does not act as a mirror image, any inputs would be highly appreciated. I hope this is the right way to configure the registry service and pass arguments to the docker daemon.

Websites: https://github.com/docker/distribution/blob/master/docs/mirror.md http://docs.master.dockerproject.org/articles/registry_mirror/

Steps:

  • I added arguments to go to the docker daemon process and restarted it:

    # /etc/sysconfig/docker # # Other arguments to pass to the docker daemon process # These will be parsed by the sysv initscript and appended # to the arguments list passed to docker -d OPTIONS="--registry-mirror=http://localhost:5000" 
  • The registry configuration is added and installed in the container:

     version: 0.1 log: fields: service: registry storage: cache: blobdescriptor: inmemory filesystem: rootdirectory: /var/lib/registry http: addr: :5000 headers: X-Content-Type-Options: [nosniff] health: storagedriver: enabled: true interval: 10s threshold: 3 proxy: remoteurl: https://registry-1.docker.io 
  • Running Registry Container

     docker run -d -p 5000:5000 --restart=always --name registry-mirror -v /opt/docker-registry/local/images:/var/lib/registry -v /opt/docker-registry/local/config/config.yml:/etc/docker/registry/config.yml -e STANDALONE=false -e MIRROR_SOURCE=https://registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io registry:2.1.1 
  • Test caching using the commands as follows:

    When my mirror is working, pull an image that I have not yet pulled out (using from time to time)

    Pulls from a docker hub configured as MIRROR_SOURCE

     $ time docker pull busybox:latest 

    Delete image from local computer

     $ docker rmi busybox:latest 

    Finally, this should drag the image from the cache, which does not work in my case, instead of pulling the dockers from the hub.

     $ time docker pull busybox:latest 

    I also tried to look at the volume folder of mounted images in my host file system, could not find it.

     $ ls /opt/docker-registry/local/images/docker/registry/v2/repositories/ 

    I tried redirecting the api call to this new image, instead it returns an error message:

     $ curl http://localhost:5000/v2/busybox/tags/list {"errors":[{"code":"NAME_UNKNOWN","message":"repository name not known to registry","detail":{"name":"busybox"}}]} 
+5
source share
1 answer

He worked for me using ...

 docker run -p 5000:5000 \ -e STANDALONE=false \ -e MIRROR_SOURCE=https://registry-1.docker.io \ -e MIRROR_SOURCE_INDEX=https://index.docker.io \ -e "REGISTRY_LOG_LEVEL=debug" \ -e "REGISTRY_REDIRECT_DISABLE=true" \ -v /var/lib/registry:/var/lib/registry \ --name registry-cache-latest \ registry 

.. and then pointintg -registry-mirror to the http server, not https.

+1
source

All Articles