Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cli/command/image/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ func RunPush(dockerCli command.Cli, opts pushOptions) error {
ctx := context.Background()

// Resolve the Auth config relevant for this server
authConfig := command.ResolveAuthConfig(ctx, dockerCli, repoInfo.Index)
authConfig := AuthResolver(dockerCli)(ctx, repoInfo.Index)

encodedAuth, err := command.EncodeAuthToBase64(authConfig)
if err != nil {
return err
Expand Down
3 changes: 3 additions & 0 deletions cli/command/image/trust.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"io"
"io/ioutil"
"sort"
"strings"

"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/streams"
Expand Down Expand Up @@ -344,6 +345,8 @@ func TagTrusted(ctx context.Context, cli command.Cli, trustedRef reference.Canon
// AuthResolver returns an auth resolver function from a command.Cli
func AuthResolver(cli command.Cli) func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig {
return func(ctx context.Context, index *registrytypes.IndexInfo) types.AuthConfig {
index.Name = strings.ToLower(index.Name)

return command.ResolveAuthConfig(ctx, cli, index)
}
}
2 changes: 1 addition & 1 deletion cli/command/registry/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func runLogin(dockerCli command.Cli, opts loginOptions) error { //nolint: gocycl
authServer = command.ElectAuthServer(ctx, dockerCli)
)
if opts.serverAddress != "" && opts.serverAddress != registry.DefaultNamespace {
serverAddress = opts.serverAddress
serverAddress = strings.ToLower(opts.serverAddress)
} else {
serverAddress = authServer
}
Expand Down
9 changes: 7 additions & 2 deletions cli/command/registry/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package registry
import (
"context"
"fmt"
"strings"

"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
Expand Down Expand Up @@ -43,9 +44,13 @@ func runLogout(dockerCli command.Cli, serverAddress string) error {
hostnameAddress = serverAddress
)
if !isDefaultRegistry {
hostnameAddress = registry.ConvertToHostname(serverAddress)
hostnameAddress = registry.ConvertToHostname(strings.ToLower(serverAddress))

// Appending not lowercased version for backward compatibility where user had
// saved the registry with an uppercase letters.
regsToLogout = append(regsToLogout, registry.ConvertToHostname(serverAddress))
// the tries below are kept for backward compatibility where a user could have
// saved the registry in one of the following format.
// saved the registry in one of the following formats.
regsToLogout = append(regsToLogout, hostnameAddress, "http://"+hostnameAddress, "https://"+hostnameAddress)
}

Expand Down