From 689bd9006da1787ae9eb33a58ba7d405cdc3e4ea Mon Sep 17 00:00:00 2001 From: bunnysayzz Date: Fri, 9 Oct 2026 21:42:40 +0530 Subject: [PATCH] fix: return remote build context download errors When the remote context download fails (e.g. HTTP 404), runBuild swallowed the error and continued with a nil build context, tarring an empty context and sending it to the daemon. Every other context-type branch returns the error; the remote branch only flushed the progress buffer in quiet mode and fell through. Return the download error like the other branches do, after flushing the progress buffer in quiet mode. Signed-off-by: bunnysayzz --- cli/command/image/build.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/command/image/build.go b/cli/command/image/build.go index 26a873985429..6d0ef145c43b 100644 --- a/cli/command/image/build.go +++ b/cli/command/image/build.go @@ -260,8 +260,11 @@ func runBuild(ctx context.Context, dockerCli command.Cli, options buildOptions) contextDir = tempDir case build.ContextTypeRemote: buildCtx, relDockerfile, err = build.GetContextFromURL(progBuff, options.context, options.dockerfileName) - if err != nil && options.quiet { - _, _ = fmt.Fprintln(dockerCli.Err(), progBuff) + if err != nil { + if options.quiet { + _, _ = fmt.Fprintln(dockerCli.Err(), progBuff) + } + return fmt.Errorf("unable to prepare context: %w", err) } default: return fmt.Errorf("unable to prepare context: path %q not found", options.context)