@@ -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
@@ -87,15 +86,13 @@ func runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error
8786 // Check if reference has a digest
8887 _ , isCanonical := distributionRef .(reference.Canonical )
8988 if ! opts .untrusted && ! isCanonical {
90- err = trustedPull (ctx , dockerCLI , imgRefAndAuth , opts )
89+ if err := trustedPull (ctx , dockerCLI , imgRefAndAuth , opts ); err != nil {
90+ return err
91+ }
9192 } else {
92- err = imagePullPrivileged (ctx , dockerCLI , imgRefAndAuth , opts )
93- }
94- if err != nil {
95- if strings .Contains (err .Error (), "when fetching 'plugin'" ) {
96- return errors .New (err .Error () + " - Use `docker plugin install`" )
93+ if err := imagePullPrivileged (ctx , dockerCLI , imgRefAndAuth , opts ); err != nil {
94+ return err
9795 }
98- return err
9996 }
10097 _ , _ = fmt .Fprintln (dockerCLI .Out (), imgRefAndAuth .Reference ().String ())
10198 return nil
0 commit comments