From fb3f2da50ea63e219080c2e63b64c64ac58c80be Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 8 Sep 2025 20:02:40 +0200 Subject: [PATCH] cli/command/plugin: remove special error handling on install, upgrade Similar to 323fbc485e5902fbbab97ad86cb5d4f90f956e39 - this code was added in [moby@c127d96], but used string-matching to detect cases where a user tried to install an image as plugin. However, this handling no longer matched any error-strings, so no longer worked: docker plugin install busybox Error response from daemon: did not find plugin config for specified reference docker.io/library/busybox:latest [moby@c127d96]: https://github.com/moby/moby/commit/c127d9614f5b30bd73861877f8540a63e7d869e9 Signed-off-by: Sebastiaan van Stijn --- cli/command/plugin/install.go | 4 ---- cli/command/plugin/install_test.go | 8 -------- cli/command/plugin/upgrade.go | 4 ---- 3 files changed, 16 deletions(-) diff --git a/cli/command/plugin/install.go b/cli/command/plugin/install.go index 6175e6667..db9ed0f4a 100644 --- a/cli/command/plugin/install.go +++ b/cli/command/plugin/install.go @@ -3,7 +3,6 @@ package plugin import ( "context" "fmt" - "strings" "github.com/distribution/reference" "github.com/docker/cli/cli" @@ -94,9 +93,6 @@ func runInstall(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) } responseBody, err := dockerCLI.Client().PluginInstall(ctx, localName, options) if err != nil { - if strings.Contains(err.Error(), "(image) when fetching") { - return errors.New(err.Error() + " - Use \"docker image pull\"") - } return err } defer func() { diff --git a/cli/command/plugin/install_test.go b/cli/command/plugin/install_test.go index 697c00bc6..82eba075a 100644 --- a/cli/command/plugin/install_test.go +++ b/cli/command/plugin/install_test.go @@ -42,14 +42,6 @@ func TestInstallErrors(t *testing.T) { return nil, errors.New("error installing plugin") }, }, - { - description: "installation error due to missing image", - args: []string{"foo"}, - expectedError: "docker image pull", - installFunc: func(name string, options client.PluginInstallOptions) (io.ReadCloser, error) { - return nil, errors.New("(image) when fetching") - }, - }, } for _, tc := range testCases { diff --git a/cli/command/plugin/upgrade.go b/cli/command/plugin/upgrade.go index daf097dd0..62924dcc8 100644 --- a/cli/command/plugin/upgrade.go +++ b/cli/command/plugin/upgrade.go @@ -3,7 +3,6 @@ package plugin import ( "context" "fmt" - "strings" "github.com/distribution/reference" "github.com/docker/cli/cli" @@ -83,9 +82,6 @@ func runUpgrade(ctx context.Context, dockerCLI command.Cli, opts pluginOptions) responseBody, err := dockerCLI.Client().PluginUpgrade(ctx, opts.localName, options) if err != nil { - if strings.Contains(err.Error(), "target is image") { - return errors.New(err.Error() + " - Use `docker image pull`") - } return err } defer func() {