How to create an external insecure registry or mirror with docker for mac

Hi,
Using Docker for mac, (docker version 1.12.1), I would like to create a simple cache for all my docker images.

I’m unable to get it to work. Here is a script to recreate what I’ve done:

mkdir ~/data ; mkdir ~/temp ; cd ~/temp
docker create --name registry registry:2
docker cp registry:/etc/docker/registry/config.yml .
docker rm -f registry
printf 'proxy:\n  remoteurl: https://registry-1.docker.io\n' | tee -a config.yml
docker run -d -p 5000:5000 --restart=always --name registry -v ~/data:/var/lib/registry -v $(pwd)/config.yml:/etc/docker/registry/config.yml registry:2

The registry starts ok. Then I go to my docker-for-mac preferences and add localhost:5000 to the “registry mirrors” in the “advanced” panel. Then I restart.

After restart, I do a pull, an rmi and a pull of an image, but the registry logs don’t show any access and the pull re-downloads the data.

I expect this to use my local registry (even though it might not be available when docker first restarts).

Any ideas how to get this to work?

Incidentally, I also tried a vagrant version and was unable to get that to work either.

Thanks,
Phil

Hi all,
I’ve found the solution. It works when you supply a http:// prefix.

I was misled by the default help text when you first add a registry, it says mydomain.com:5000, which implies it should work without the prefix. But apparently not.

Some links, for reference.
Docs: https://docs.docker.com/registry/recipes/mirror/

The SO question that finally tipped me into trying the http prefix: http://stackoverflow.com/questions/30930847/how-to-set-up-a-docker-registry-acting-as-a-proxy/39717783#39717783

Thanks,
Phil