Docker Community Forums

Share and learn in the Docker community.

Unable to get registry cache to work

I am trying to setup a docker registry mirror using the steps here and here

The command I use to start the registry mirror is

docker run -d --restart=always -p 5000:5000 --name registry-mirror -v /Users/proxycache/docker-proxy-cache/data:/var/lib/registry -v /Users/proxycache/docker-proxy-cache/config:/etc/docker/registry registry:2

my config looks like

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

I did not setup any certs because this is just local and not tied to a domain.

after it starts I am able to run curl -I http://proxycache.local:5000/v2/ and I get

HTTP/1.1 200 OK
Content-Length: 2
Content-Type: application/json; charset=utf-8
Docker-Distribution-Api-Version: registry/2.0
X-Content-Type-Options: nosniff
Date: Mon, 20 Feb 2017 17:52:21 GMT

I can also run curl http://proxycache.local:5000/v2/_catalog and I get

{"repositories":[]}

My client is a MAC so I am using docker for mac. I open the preferences and go to the daemon tab and put in proxycache.local:5000 in the registry mirrors section

If I run docker info I get

Containers: 0
 Running: 0
 Paused: 0
 Stopped: 0
Images: 42
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 43
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.8-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: HXKP:QFBD:XRUI:QFT5:PGDD:CSSZ:JUI2:NLAJ:SKG5:U3X4:H2JP:KTS6
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 26
 System Time: 2017-02-20T21:43:30.400431883Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Username: username
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 proxycache.local:5000
 127.0.0.0/8
Registry Mirrors:
 proxycache.local:5000
Live Restore Enabled: false

The part where it says

Registry Mirrors:
 http://proxycache.local:5000/

seems to indicate that minikube is setup correctly

If I run docker pull busybox:latest it downloads the image, but does not update the mirror. If I pull the catalog curl http://proxycache.local:5000/v2/_catalog it is still empty

What else am I missing?

nevermind. I figured it out.

@ryanmcjolt what was missing? How did you get it working?

Docker, did not seem to like the way we had setup our DNS. So I used the IP address of the machine in the Registry mirrors section instead of the DNS name and it worked.