1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Removing the restriction to push to a 'official' repo

Signed-off-by: toli <toli@docker.com>
This commit is contained in:
toli 2015-12-03 17:01:39 -08:00
parent 5e0283effa
commit 0d824c760e

View file

@ -2,7 +2,6 @@ package client
import (
"errors"
"fmt"
"io"
"github.com/docker/distribution/reference"
@ -45,17 +44,6 @@ func (cli *DockerCli) CmdPush(args ...string) error {
}
// Resolve the Auth config relevant for this server
authConfig := registry.ResolveAuthConfig(cli.configFile.AuthConfigs, repoInfo.Index)
// If we're not using a custom registry, we know the restrictions
// applied to repository names and can warn the user in advance.
// Custom repositories can have different rules, and we must also
// allow pushing by image ID.
if repoInfo.Official {
username := authConfig.Username
if username == "" {
username = "<user>"
}
return fmt.Errorf("You cannot push a \"root\" repository. Please rename your repository to <user>/<repo> (ex: %s/%s)", username, repoInfo.LocalName)
}
requestPrivilege := cli.registryAuthenticationPrivilegedFunc(repoInfo.Index, "push")
if isTrusted() {