@@ -2,15 +2,14 @@ package image
22
33import (
44 "context"
5+ "errors"
56 "fmt"
6- "strings"
77
88 "github.com/distribution/reference"
99 "github.com/docker/cli/cli"
1010 "github.com/docker/cli/cli/command"
1111 "github.com/docker/cli/cli/command/completion"
1212 "github.com/docker/cli/cli/trust"
13- "github.com/pkg/errors"
1413 "github.com/spf13/cobra"
1514)
1615
@@ -78,15 +77,13 @@ func runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error
7877 // Check if reference has a digest
7978 _ , isCanonical := distributionRef .(reference.Canonical )
8079 if ! opts .untrusted && ! isCanonical {
81- err = trustedPull (ctx , dockerCLI , imgRefAndAuth , opts )
80+ if err := trustedPull (ctx , dockerCLI , imgRefAndAuth , opts ); err != nil {
81+ return err
82+ }
8283 } else {
83- err = imagePullPrivileged (ctx , dockerCLI , imgRefAndAuth , opts )
84- }
85- if err != nil {
86- if strings .Contains (err .Error (), "when fetching 'plugin'" ) {
87- return errors .New (err .Error () + " - Use `docker plugin install`" )
84+ if err := imagePullPrivileged (ctx , dockerCLI , imgRefAndAuth , opts ); err != nil {
85+ return err
8886 }
89- return err
9087 }
9188 _ , _ = fmt .Fprintln (dockerCLI .Out (), imgRefAndAuth .Reference ().String ())
9289 return nil
0 commit comments