Issue #3128
closedClarify image tagging vs. image naming
Description
As implemented upstream, within the REST API, a Docker registry refers to an image "name" as described in this doc:
https://docs.docker.com/registry/spec/api/#detail
For instance, for fetching a manifest:
GET /v2/<name>/manifests/<reference>
Their docs say:
Fetch the manifest identified by name and reference where reference can be a tag or digest. A HEAD request can also be issued to this endpoint to obtain resource information without receiving all data.
The <name> portion is typically a two-level (it may be more than two, but I am documenting what I typically see in a registry implemented by Docker) hiearchy, essentially <repo name>/<image name>.
Using the Docker client (from fedora 26), if I issue a "docker pull" command like:
docker pull registry.example.com/test-docker/app-nginx:latest
(general syntax is docker pull <registry>/<repo_id>/<image_name>:<tag>)
the repository is test-docker and the image name is app-rest. I am fetching the tag named latest.
This results in a REST call like:
GET /v2/test-docker/app-nginx/manifests/latest
I have attempted to replicate this behavior. Since Tag units in pulp only have a name (the tag value), and since Manifest units don't have a name (or at least Skopeo doesn't produce one, even though there is a "name" property that is available from querying a v2 manifest directly from a Docker registry), what I've tried was to name the tag "app-nginx:latest".
Question 1: was this ever considered as a use case? If so, is my attempt completely wrong?
Crane has no concept of repo, name and tag, I am in the process of fixing that, with a PR coming shortly if that is the case.
Assuming what I tried above is worthwhile: pulp's docker plugin has no concept of name + tag either, so the distributor produces a json document in the publish directory for v2, named <repo_id>/tags/list, containing:
{"name": "test-docker", "tags": ["app-nginx:latest", "latest"]}
The name here should have been "test-docker/app-nginx" and the tags should have been ["latest"]
So clearly my approach doesn't produce the right tags, and would require patching pulp_docker as well.
Talking to Thomas McKay on #pulp-dev, maybe I should ask the second question: how is image management intended to work in Pulp? For our use case, I need a pulp repo to contain different docker image types (i.e. different names) and their updates. Hypothetically, a deployment would consist of the following containers: app-nginx, app-mysql, app-server . Because they are all related, I want them all entitled the same way, so it would make sense to put them all in the same pulp repository (as well as their updates).