Skip to content

Commit 323fbc4

Browse files
committed
cli/command/image: remove special handling for plugin errors on pull
This special handling was added in [moby@9b6dcc8], and later updated in [moby@c127d96], but it fully depended on string-matching, which is brittle. Testing the original ticket that lead to this handling, it looks like the string matching no longer works, and the daemon error is returned as-is: With graphdrivers: docker pull tiborvass/no-remove Using default tag: latest Error response from daemon: Encountered remote "application/vnd.docker.plugin.v0+json"(unknown) when fetching With containerd snapshotters enabled: docker pull tiborvass/no-remove Using default tag: latest latest: Pulling from tiborvass/no-remove cf635291f7c9: Download complete failed to unpack image on snapshotter overlayfs: mismatched image rootfs and manifest layers The error-message for containerd can probably be improved, but as the special handling in the CLI no longer works, we can remove it. [moby@9b6dcc8]: moby/moby@9b6dcc8 [moby@c127d96]: moby/moby@c127d96 Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 701b678 commit 323fbc4

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cli/command/image/pull.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ package image
22

33
import (
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

Comments
 (0)