Sync from un-namespaced V2 repository fails
When attempting to sync an un-namespaced repository from a V2 registry, the sync fails with 'Not found'.
With V1 registries there was a default namespace of 'library', so 'docker pull myimage' would really be pulling 'library/myimage'.
I don't believe this to be the case with V2. Wheresa the V1 API was specified in terms of /v1/<namespace>/<repository>/..., the V2 API is specified in terms of /v2/<name>/... .
As a result, when pulp-docker adds the 'library/' prefix, this fails with V2 registries.
#4 Updated by firstname.lastname@example.org over 4 years ago
As far as I can tell, /v2/<name/ is the same as the /v1/<namespace>/<repository>. In the case that there is no namespace, Docker hub still hosts the content at library/<repository>, so I am assuming that <name> = <namespace>/<repository>
Neither will correctly work at the moment due to the auth bug, but on the branch that is fixing that:
This will sync correctly:
pulp-admin docker repo create --repo-id=busybox --feed=https://registry-1.docker.io --upstream-name=library/busybox
This will not sync correctly:
pulp-admin docker repo create --repo-id=busybox --feed=https://registry-1.docker.io --upstream-name=busybox
To fix this, we have some options.
1. upstream-name could be required to have a namespace. I this is not ideal, since docker itself doesn't require this and assumes library/<repo> if a namespace is not provided.
2. We can prepend "library/" to self.name here: https://github.com/pulp/pulp_docker/blob/master/plugins/pulp_docker/plugins/registry.py#L290 This would be my preference, but I am unsure if this would have unintended consequences elsewhere. Specifically I am curious why for v1 this is only done in the `get_tags` function. This works with the busybox repo example above.
3. We could prepend "library/" where it is needed. At least get_tags.
#5 Updated by twaugh over 4 years ago
So, for Docker Hub, adding "library" will work because Docker Hub is special.
For other Distribution instances, or other implementations, adding "library" will not work. "busybox" and "library/busybox" reference different repositories, except as a special case on Docker Hub.
That's what this bug is about: when syncing from a V2 registry, "library" is always added and that is incorrect.
To be clear: correct behaviour would be for pulp_docker to be requesting /v2/busybox/ when upstream-name is busybox. The current incorrect behaviour is that it requests /v2/library/busybox/.
Please register to edit this issue