docker/compose · error

failed to get version of buildx

Error message

failed to get version of buildx

What it means

Before using the bake path, compose locates the buildx CLI plugin via manager.GetPlugin and requires a non-empty version string. manager.GetPlugin resolves the plugin by running 'docker buildx version' (or reading plugin metadata); if the plugin exists but its version could not be determined (empty output, unparseable output, or a plugin shim that reports nothing), this bare error is returned. The sibling branch above returns buildx.Err when plugin discovery itself failed.

Source

Thrown at pkg/compose/build_bake.go:438

		results[image] = s.canonicalBuiltDigest(ctx, image, service.Platform, built.Digest)
		s.events.On(builtEvent(image))
	}

	return results, nil
}

func (s *composeService) getBuildxPlugin() (*manager.Plugin, error) {
	buildx, err := manager.GetPlugin("buildx", s.dockerCli, &cobra.Command{})
	if err != nil {
		return nil, err
	}

	if buildx.Err != nil {
		return nil, buildx.Err
	}

	if buildx.Version == "" {
		return nil, fmt.Errorf("failed to get version of buildx")
	}

	if versions.LessThan(buildx.Version[1:], buildxMinVersion) {
		return nil, fmt.Errorf("compose build requires buildx %s or later", buildxMinVersion)
	}

	return buildx, nil
}

// makeConsole wraps the provided writer to match [containerd.File] interface if it is of type *streams.Out.
// buildkit's NewDisplay doesn't actually require a [io.Reader], it only uses the [containerd.Console] type to
// benefits from ANSI capabilities, but only does writes.
func makeConsole(out io.Writer) io.Writer {
	if s, ok := out.(*streams.Out); ok {
		return &_console{s}
	}
	return out
}

View on GitHub (pinned to ddc4b044b6)

Solutions

  1. Verify the plugin responds: docker buildx version — if it errors or prints nothing, reinstall buildx
  2. Reinstall: remove the broken plugin binary under ~/.docker/cli-plugins (or /usr/local/lib/docker/cli-plugins) and install the latest release
  3. Check plugin binary permissions (must be executable) and that no shim/wrapper shadows it
  4. Ensure DOCKER_CLI_PLUGIN_EXTRA_DIRS does not point at stale copies

Example fix

# before
$ docker buildx version
(no output / error)
# after
$ rm ~/.docker/cli-plugins/docker-buildx
$ curl -sSL https://github.com/docker/buildx/releases/latest/download/buildx-v0.17.0.linux-amd64 -o ~/.docker/cli-plugins/docker-buildx
$ chmod +x ~/.docker/cli-plugins/docker-buildx
$ docker buildx version
Defensive patterns

Strategy: validation

Validate before calling

// Before builds that need bake, verify the plugin reports a version:
out, err := exec.Command("docker", "buildx", "version").Output()
if err != nil || len(strings.TrimSpace(string(out))) == 0 {
	return fmt.Errorf("buildx plugin missing or broken; reinstall it before building")
}

Prevention

When it happens

Trigger: A buildx plugin binary on PATH that does not respond to the version query (broken install, wrapper script, empty output); plugin installation interrupted leaving a non-functional binary; custom DOCKER_CLI_PLUGIN_EXTRA_DIRS shims masking the real buildx.

Common situations: Manually installed or aliased buildx binaries that are corrupted; plugin directories with wrong permissions; partial docker-compose/buildx container images; CI images where buildx was curl-ed in incompletely.

Related errors


AI-assisted analysis of docker/compose@ddc4b044b6 (2026-08-15). Data as JSON: /api/errors/5cc1bea8364cdf33. Report an issue: GitHub.