diff --git a/cli/command/plugin/install.go b/cli/command/plugin/install.go index 9cb93b3b2702..da86dba9ddb5 100644 --- a/cli/command/plugin/install.go +++ b/cli/command/plugin/install.go @@ -10,9 +10,7 @@ import ( "github.com/docker/cli/cli/command" "github.com/docker/cli/internal/jsonstream" "github.com/docker/cli/internal/prompt" - "github.com/docker/cli/internal/registry" "github.com/moby/moby/api/types/plugin" - registrytypes "github.com/moby/moby/api/types/registry" "github.com/moby/moby/client" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -60,8 +58,7 @@ func buildPullConfig(dockerCLI command.Cli, opts pluginOptions) (client.PluginIn return client.PluginInstallOptions{}, err } - authConfig := command.ResolveAuthConfig(dockerCLI.ConfigFile(), registry.NewIndexInfo(ref)) - encodedAuth, err := registrytypes.EncodeAuthConfig(authConfig) + encodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCLI.ConfigFile(), ref.String()) if err != nil { return client.PluginInstallOptions{}, err } diff --git a/cli/command/plugin/push.go b/cli/command/plugin/push.go index 37bf997f6a09..a4a830f41ef1 100644 --- a/cli/command/plugin/push.go +++ b/cli/command/plugin/push.go @@ -8,8 +8,6 @@ import ( "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/internal/jsonstream" - "github.com/docker/cli/internal/registry" - registrytypes "github.com/moby/moby/api/types/registry" "github.com/spf13/cobra" ) @@ -40,8 +38,7 @@ func runPush(ctx context.Context, dockerCli command.Cli, name string) error { } named = reference.TagNameOnly(named) - authConfig := command.ResolveAuthConfig(dockerCli.ConfigFile(), registry.NewIndexInfo(named)) - encodedAuth, err := registrytypes.EncodeAuthConfig(authConfig) + encodedAuth, err := command.RetrieveAuthTokenFromImage(dockerCli.ConfigFile(), named.String()) if err != nil { return err }