Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix BZ#1420279: not possible to push to docker.io with --add-registry
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
  • Loading branch information
runcom committed Feb 8, 2017
1 parent f1af7dc commit 146d0e3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion api/client/registry.go
Expand Up @@ -98,7 +98,7 @@ func (cli *DockerCli) promptWithDefault(prompt string, configDefault string) {
func (cli *DockerCli) ResolveAuthConfig(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig {
configKey := index.Name
if index.Official {
configKey = cli.ElectAuthServer(ctx)
configKey = registry.IndexServer
}

a, _ := GetCredentials(cli.configFile, configKey)
Expand Down
25 changes: 18 additions & 7 deletions registry/config.go
Expand Up @@ -302,16 +302,27 @@ func GetAuthConfigKey(index *registrytypes.IndexInfo) string {
// newRepositoryInfo validates and breaks down a repository name into a RepositoryInfo
func newRepositoryInfo(config *serviceConfig, name reference.Named) (*RepositoryInfo, error) {
indexName := name.Hostname()
if indexName == "" {
indexName = IndexServerName()
if indexName == "" {
return nil, fmt.Errorf("No default registry configured.")
}
fqr, err := reference.QualifyUnqualifiedReference(name, indexName)
if reference.IsReferenceFullyQualified(name) {
var err error
indexName, _, err = reference.SplitReposName(name)
if err != nil {
return nil, err
}
name = fqr
if indexName == "" {
indexName = IndexName
}
} else {
if indexName == "" {
indexName = IndexServerName()
if indexName == "" {
return nil, fmt.Errorf("No default registry configured.")
}
fqr, err := reference.QualifyUnqualifiedReference(name, indexName)
if err != nil {
return nil, err
}
name = fqr
}
}
index, err := newIndexInfo(config, indexName)
if err != nil {
Expand Down

0 comments on commit 146d0e3

Please sign in to comment.