Allow hyphens in namespaces.

We have some cases using a private registry where it would be convenient to be able to use hostnames and other strings that can include "-" as namespaces. The [original discussion about the acceptable characters in namespaces](https://github.com/docker/docker/pull/663#issuecomment-18437921) seemed a bit ambivalent on whether hyphens should be accepted in namespaces, so we'd like to propose voting them in.

This won't establish precedent for namespaces that aren't valid Docker hub usernames. The Docker client [accepts underscores in namespaces](https://github.com/docker/docker/blob/c478143ec0ca8f610f7980991b9b2ba0e1160b3e/registry/registry.go#L27), even though the Docker hub (despite [documentation to the contrary](https://docs.docker.com/reference/api/docker-io_api/#user-register)) doesn't allow them in usernames. Trying to create `test_user` today returns `Wrong username format (it has to match "^[a-z0-9]{4,30}$")`.

Signed-off-by: Matthew Riley <mattdr@google.com>
ughhhh true

On Mon, Dec 15, 2014 at 2:55 PM, Matthew Riley <notifications@github.com>
wrote:
>
> In registry/registry_test.go
> <https://github.com/docker/docker/pull/8961#discussion-diff-21864640>:
>
> > -	}
> > -	// Support 64-byte non-hexadecimal names (hexadecimal names are forbidden)
> > -	if err := validateRepositoryName("thisisthesongthatneverendsitgoesonandonandonthisisthesongthatnev"); err != nil {
> > -		t.Fatal(err)
> > +	validRepositoryNames := []string{
> > +		// Sanity check.
> > +		"docker/docker",
> > +
> > +		// Support 64-byte non-hexadecimal names (hexadecimal names are forbidden).
> > +		"thisisthesongthatneverendsitgoesonandonandonthisisthesongthatnev",
> > +
> > +		// Allow embedded hyphens.
> > +		"docker-rules/docker",
> > +
> > +		// Allow underscores everywhere (as opposed to hyphens).
> > +		"____/____",
>
> Today I can create a repository with this name using the Docker client. I
> can push it if I'm targeting the Docker open-source registry. Since I
> *can*, we must assume people *have*. Are we going to break them?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/docker/docker/pull/8961/files#r21864640>.
>