Docker Community Forums

Share and learn in the Docker community.

Pull-Through Caching Registry on Docker for Mac

docker
insecure-registry

(Jamiejackson) #1

Docker for Mac: Docker version 17.06.2-ce, build cec0b72

I had the pull-through cache registry working for months, but today, I tried to recreate it so I could document it. However, I’m having no luck getting the daemon to pull through it.

Registry Setup

$ docker run -d --restart=always -p 5000:5000 --name cache-registry \
  -v cache-registry:/var/lib/registry \
  -e REGISTRY_PROXY_REMOTEURL=https://registry-1.docker.io \
  registry:2.5

The registry responds:

$ curl http://localhost:5000/v2/_catalog
{"repositories":[]}

Daemon Setup

I configure Docker for Mac with the following. (I’ve tried with and without http:// prefixes):

{
  "insecure-registries" : [
    "localhost:5000"
  ],
  "debug" : true,
  "experimental" : true,
  "registry-mirrors" : [
    "localhost:5000"
  ]
}

Previous (Good) Behavior

When the registry did work, when I had done docker pull ubuntu && docker image rm ubuntu && docker pull ubuntu, that second pull would be quick, because it would pull the cached copy. Now, it is the same slow download both times.

Current (Bad) Behavior – Pulling an Image (with Logs)

Pull

$ docker pull alpine
Using default tag: latest
latest: Pulling from library/alpine
88286f41530e: Already exists
Digest: sha256:f006ecbb824d87947d0b51ab8488634bf69fe4094959d935c0c103f4820a417d
Status: Downloaded newer image for alpine:latest

Logs

$ syslog -w -k Sender Docker
...
Sep 20 18:41:21 ICF2008571 Docker[4254] <Notice>: DNS lookup registry-1.docker.io A: registry-1.docker.io <IN|16> [A (34.225.121.244)], registry-1.docker.io <IN|16> [A (52.5.185.86)], registry-1.docker.io <IN|16> [A (54.152.220.218)], registry-1.docker.io <IN|16> [A (52.5.247.186)], registry-1.docker.io <IN|16> [A (52.206.156.207)], registry-1.docker.io <IN|16> [A (54.85.174.159)]
Sep 20 18:41:21 ICF2008571 Docker[4254] <Notice>: DNS lookup auth.docker.io A: auth.docker.io <IN|14> [A (54.152.220.218)], auth.docker.io <IN|14> [A (52.5.247.186)], auth.docker.io <IN|14> [A (52.206.156.207)], auth.docker.io <IN|14> [A (54.85.174.159)], auth.docker.io <IN|14> [A (34.225.121.244)], auth.docker.io <IN|14> [A (52.5.185.86)]
Sep 20 18:41:21 ICF2008571 Docker[4254] <Notice>: DNS lookup registry-1.docker.io A: registry-1.docker.io <IN|16> [A (34.225.121.244)], registry-1.docker.io <IN|16> [A (52.5.185.86)], registry-1.docker.io <IN|16> [A (54.152.220.218)], registry-1.docker.io <IN|16> [A (52.5.247.186)], registry-1.docker.io <IN|16> [A (52.206.156.207)], registry-1.docker.io <IN|16> [A (54.85.174.159)]
--- last message repeated 2 times ---
Sep 20 18:41:22 ICF2008571 Docker[4254] <Notice>: DNS lookup dseasb33srnrn.cloudfront.net A: dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.92)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.114)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.163)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.186)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.194)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.251)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.71)], dseasb33srnrn.cloudfront.net <IN|38> [A (54.192.7.132)]

Please help me get this working (again).

Thanks,
Jamie


(Jamiejackson) #2

Now I’m using this, which works:

{
  "insecure-registries" : [
    "http://127.0.0.1:5000"
  ],
  "debug" : true,
  "experimental" : true,
  "registry-mirrors" : [
    "http://127.0.0.1:5000"
  ]
}