From 3e686a8b591733ee4689b8c90b903f46e8c455c1 Mon Sep 17 00:00:00 2001 From: Nicolas Beck Date: Fri, 9 Oct 2026 10:06:48 +0000 Subject: [PATCH] cmd/docker: Add guidance for unavailable offload commands Show installation guidance and a documentation link when the offload plugin is missing or invalid. Handle this before command execution so plugin-specific flags and --help also receive the guidance. Signed-off-by: Nicolas Beck --- cmd/docker/docker.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/docker/docker.go b/cmd/docker/docker.go index 47c720e941f5..92dfce8cdd2c 100644 --- a/cmd/docker/docker.go +++ b/cmd/docker/docker.go @@ -571,11 +571,15 @@ func runDocker(ctx context.Context, dockerCli *command.DockerCli) error { return nil } if !errdefs.IsNotFound(err) { - // For plugin not found we fall through to - // cmd.Execute() which deals with reporting - // "command not found" in a consistent way. return err } + if args[0] == "offload" { + // Report this before cmd.ExecuteContext(): plugin-specific flags such as + // --cpus otherwise fail parsing before the root command's RunE. + return errors.New("docker: to use 'docker offload', install the plugin.\nSee https://docs.docker.com/go/cloud-flag/") + } + // Other missing or invalid plugins fall through to cmd.ExecuteContext(), + // which reports the standard unknown-command error. } }