Docker Community Forums

Share and learn in the Docker community.

Docker registry v2 spec and repository naming rule

(Wwwsahoo) #1

Docker Registry HTTP API v2 states the following about repository names (the document refers to library/ubuntu as an example repository name):

Classically, repository names have always been two path components where each path component is less than 30 characters. The V2 registry API does not enforce this. 

The above statements suggest that having two components in repository name is more of a convention than a rule.

The document then states the rules for a repository name are as follows:

A repository name is broken up into path components. A component of a repository name must be at least one lowercase, alpha-numeric characters, optionally separated by periods, dashes or underscores. More strictly, it must match the regular expression [a-z0-9]+(?:[._-][a-z0-9]+)*.
If a repository name has two or more path components, they must be separated by a forward slash ("/").
The total length of a repository name, including slashes, must be less the 256 characters.

The second rule above clearly suggests a repository name can have more than two path components. The public registry (the one hosted at Docker Hub) does not seem to allow more than two path components.
Is the public docker registry not a compliant implementation of the spec?
Can anyone clarify if a compliant V2 registry implementation must support repository names having more than two path components?
What’s the behaviour of the implementation available as distribution/registry:2 docker image?