docker-mirror
docker-mirror copied to clipboard
Docker Registry not supported
The Docker Hub and Docker Registry APIs appear to be different. Different JSON is returned when querying the two most similar URLs:
https://registry.hub.docker.com/v2/repositories/jippi/hashi-ui/tags/?page_size=2048 http://my.docker.registry.com/v2/namespace/repo/tags/list?n=2048
It looks like mirror.go is expecting 'count' etc, that is not present in the Registry JSON. I'm sure there are other differences but I did not pursue much further once I realized the APIs were different.
Scrubbed example of Registry JSON:
{"name":"namespace/reponame","tags":["0.1.0-10","0.1.0-11","0.1.0-13","0.1.0-14","0.1.0-15","0.1.0-16","0.1.0-17","0.1.0-18","0.1.0-19","0.1.0-2","0.1.0-20","0.1.0-21","0.1.0-22","0.1.0-23","0.1.0-24","0.1.0-25","0.1.0-26","0.1.0-27","0.1.0-28","0.1.0-29","0.1.0-3","0.1.0-4","0.1.0-6","0.1.0-7","0.1.0-8","0.1.0-9","latest-ci","latest-qa","latest"]}
I don't have a docker registry to test with :( is there any OSS version ?
This is what we are running internally: https://hub.docker.com/_/registry/
I might be able to get to this next week or early January
a PR is also welcome
10-4. I ended up scripting something simple that worked for me but I'm sure docker-mirror does a much better job. I am personally not in need of the enhancement at this point but I'm sure it would be useful to others in the future. :)
I implemented this functionality in a local fork. Will post a PR.
There are some caveats, though: the registry API for getting tags is fairly limited: it only gets you the tags without any kind of last-modified-date information. It's possible to evoke that information from the related manifest (https://stackoverflow.com/questions/32605556/how-to-find-the-creation-date-of-an-image-in-a-private-docker-registry-api-v2) but at least when using Nexus as the registry, getting the manifest is quite slow (several seconds).