diff --git a/cli/command/image/build.go b/cli/command/image/build.go index f7f0493d5d6f..4d54cae2f7d0 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -10,7 +10,6 @@ import ( "io" "os" "path/filepath" - "runtime" "strings" "github.com/distribution/reference" @@ -385,16 +384,6 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) return err } - // Windows: show error message about modified file permissions if the - // daemon isn't running Windows. - if response.OSType != "windows" && runtime.GOOS == "windows" && !options.quiet { - _, _ = fmt.Fprintln(dockerCli.Out(), "SECURITY WARNING: You are building a Docker "+ - "image from Windows against a non-Windows Docker host. All files and "+ - "directories added to build context will have '-rwxr-xr-x' permissions. "+ - "It is recommended to double check and reset permissions for sensitive "+ - "files and directories.") - } - // Everything worked so if -q was provided the output from the daemon // should be just the image ID and we'll print that to stdout. if options.quiet { diff --git a/cli/command/image/pull.go b/cli/command/image/pull.go index f1d66e2e8261..2f010fb6f139 100644 --- a/cli/command/image/pull.go +++ b/cli/command/image/pull.go @@ -2,15 +2,14 @@ package image import ( "context" + "errors" "fmt" - "strings" "github.com/distribution/reference" "github.com/docker/cli/cli" "github.com/docker/cli/cli/command" "github.com/docker/cli/cli/command/completion" "github.com/docker/cli/cli/trust" - "github.com/pkg/errors" "github.com/spf13/cobra" ) @@ -87,15 +86,13 @@ func runPull(ctx context.Context, dockerCLI command.Cli, opts pullOptions) error // Check if reference has a digest _, isCanonical := distributionRef.(reference.Canonical) if !opts.untrusted && !isCanonical { - err = trustedPull(ctx, dockerCLI, imgRefAndAuth, opts) + if err := trustedPull(ctx, dockerCLI, imgRefAndAuth, opts); err != nil { + return err + } } else { - err = imagePullPrivileged(ctx, dockerCLI, imgRefAndAuth, opts) - } - if err != nil { - if strings.Contains(err.Error(), "when fetching 'plugin'") { - return errors.New(err.Error() + " - Use `docker plugin install`") + if err := imagePullPrivileged(ctx, dockerCLI, imgRefAndAuth, opts); err != nil { + return err } - return err } _, _ = fmt.Fprintln(dockerCLI.Out(), imgRefAndAuth.Reference().String()) return nil diff --git a/cli/command/plugin/install.go b/cli/command/plugin/install.go index e232fdf0034a..715ae76ae107 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" @@ -120,9 +119,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 f66082d9302e..ee67e611d7dd 100644 --- a/cli/command/plugin/install_test.go +++ b/cli/command/plugin/install_test.go @@ -43,14 +43,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 types.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 7d4548d428f1..54a39685b702 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" @@ -80,9 +79,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() {