Skip to content

Commit 4a677b8

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]> (cherry picked from commit 323fbc4) Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 7c3ec3e commit 4a677b8

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

@@ -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

Comments
 (0)