From 8af0ec69b7dadac81fd779df997da10210c49ef6 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Mon, 17 Aug 2026 14:14:39 +0200 Subject: [PATCH] build: error messages name the real remedy, not a removed builder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The classic-builder rejections said 'set DOCKER_BUILDKIT=1 to use BuildKit', a leftover from the internal BuildKit builder removed in af579ebd4. Since then BuildKit builds go through the buildx plugin: compose falls back to the classic builder when BuildKit is disabled (DOCKER_BUILDKIT=0) OR when buildx is not installed — so the advertised fix does nothing for users who are simply missing buildx. The five messages now state the actual requirement (buildx installed, DOCKER_BUILDKIT not forced to 0), and the silent-fallback warning when buildx is missing now says what the fallback implies instead of a bare 'requires buildx plugin to be installed'. Part of #14074 (A: the code misdescribes its own structure). Signed-off-by: Nicolas De Loof --- pkg/compose/build_bake.go | 3 ++- pkg/compose/build_classic.go | 10 +++++----- pkg/e2e/build_test.go | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/pkg/compose/build_bake.go b/pkg/compose/build_bake.go index 87fce90779..255a64d8e8 100644 --- a/pkg/compose/build_bake.go +++ b/pkg/compose/build_bake.go @@ -64,7 +64,8 @@ func buildWithBake(dockerCli command.Cli) (bool, error) { _, err = manager.GetPlugin("buildx", dockerCli, &cobra.Command{}) if err != nil { if errdefs.IsNotFound(err) { - logrus.Warnf("Docker Compose requires buildx plugin to be installed") + logrus.Warnf("buildx Docker CLI plugin not found: falling back to the classic builder. " + + "BuildKit-only build features (multi-arch, secrets, ssh, additional contexts, ...) will not be available") return false, nil } return false, err diff --git a/pkg/compose/build_classic.go b/pkg/compose/build_classic.go index 58f22ccd37..857b53290a 100644 --- a/pkg/compose/build_classic.go +++ b/pkg/compose/build_classic.go @@ -232,19 +232,19 @@ func (s *composeService) doBuildImage(ctx context.Context, project *types.Projec // doesn't implement func checkClassicBuilderSupported(service types.ServiceConfig) error { if len(service.Build.Platforms) > 1 { - return fmt.Errorf("the classic builder doesn't support multi-arch build, set DOCKER_BUILDKIT=1 to use BuildKit") + return fmt.Errorf("the classic builder doesn't support multi-arch build; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0") } if service.Build.Privileged { - return fmt.Errorf("the classic builder doesn't support privileged mode, set DOCKER_BUILDKIT=1 to use BuildKit") + return fmt.Errorf("the classic builder doesn't support privileged mode; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0") } if len(service.Build.AdditionalContexts) > 0 { - return fmt.Errorf("the classic builder doesn't support additional contexts, set DOCKER_BUILDKIT=1 to use BuildKit") + return fmt.Errorf("the classic builder doesn't support additional contexts; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0") } if len(service.Build.SSH) > 0 { - return fmt.Errorf("the classic builder doesn't support SSH keys, set DOCKER_BUILDKIT=1 to use BuildKit") + return fmt.Errorf("the classic builder doesn't support SSH keys; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0") } if len(service.Build.Secrets) > 0 { - return fmt.Errorf("the classic builder doesn't support secrets, set DOCKER_BUILDKIT=1 to use BuildKit") + return fmt.Errorf("the classic builder doesn't support secrets; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0") } return nil } diff --git a/pkg/e2e/build_test.go b/pkg/e2e/build_test.go index 25fd08b4fd..756dd0eb07 100644 --- a/pkg/e2e/build_test.go +++ b/pkg/e2e/build_test.go @@ -402,7 +402,7 @@ func TestBuildPlatformsStandardErrors(t *testing.T) { }) res.Assert(t, icmd.Expected{ ExitCode: 1, - Err: "the classic builder doesn't support multi-arch build, set DOCKER_BUILDKIT=1 to use BuildKit", + Err: "the classic builder doesn't support multi-arch build; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0", }) }) @@ -470,7 +470,7 @@ func TestBuildPlatformsStandardErrors(t *testing.T) { }) res.Assert(t, icmd.Expected{ ExitCode: 1, - Err: "the classic builder doesn't support privileged mode, set DOCKER_BUILDKIT=1 to use BuildKit", + Err: "the classic builder doesn't support privileged mode; building with BuildKit requires the buildx Docker CLI plugin, and DOCKER_BUILDKIT must not be set to 0", }) }) }