Skip to main content
Glama

buildx_build

Build Docker images with BuildKit supporting multi-platform, cache, attestations, secrets, and multi-stage builds.

Instructions

Build an image with BuildKit via docker buildx build.

Replaces the legacy build_image tool when you need any of: multi-platform output (platforms), modern cache export (cache_from/cache_to), SBOM or provenance attestations, build secrets, or multi-stage builds with target. Always runs with --progress=plain so output is captured rather than redrawn on a TTY.

args: context - Build context: a filesystem path or Git/HTTP URL (verbatim; no ~/glob expansion). The - stdin-tarball form is NOT supported (stdin isn't forwarded — it'd block on the server's own stdin); serve a pre-packed tarball over HTTP instead. tags - Image references to apply (-t, repeatable) platforms - Target platforms, e.g. ["linux/amd64", "linux/arm64"] file - Dockerfile path (relative to context unless absolute) build_args - Build-time variables (each becomes --build-arg KEY=VALUE) build_contexts - Additional named build contexts (e.g. {"deps": "./vendor"}) labels - Image labels (each becomes --label KEY=VALUE) annotations - OCI manifest annotations (passed verbatim, repeatable) target - Target build stage to stop at push - Push the result to the registry (mutually exclusive with load) load - Load the result into the local image store (single-platform builds only) output - Custom --output specs (e.g. ["type=tar,dest=out.tar"]) no_cache - Do not use cache when building no_cache_filter - Stage names to exclude from caching pull - Always attempt to pull a newer version of each base image cache_from - Cache import specs, e.g. ["type=registry,ref=user/img:cache"] cache_to - Cache export specs builder - Override the active builder sbom - Shorthand for --attest=type=sbom; pass "true" or a config string provenance - Shorthand for --attest=type=provenance; pass "true", "false", or a config string attest - Custom attestation specs (repeatable) secret - Secret specs (e.g. ["id=npmrc,src=/home/user/.npmrc"] or ["id=npmrc,env=NPM_TOKEN"]). ~ in src= is NOT expanded (by this tool or the CLI) — use an absolute path. ssh - SSH agent socket/key specs (e.g. ["default"], using $SSH_AUTH_SOCK) timeout_seconds - Subprocess timeout (default 1800s) returns: dict - {"returncode": int, "stdout": str, "stderr": str, "truncated": bool}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sshNo
fileNo
loadNo
pullNo
pushNo
sbomNo
tagsNo
attestNo
labelsNo
outputNo
secretNo
targetNo
builderNo
contextYes
cache_toNo
no_cacheNo
platformsNo
build_argsNo
cache_fromNo
provenanceNo
annotationsNo
build_contextsNo
no_cache_filterNo
timeout_secondsNo
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations indicate non-read-only and non-destructive, and the description adds significant behavioral context: it always uses --progress=plain, warns about stdin not being supported, explains ~ expansion limitations in secret src, mutual exclusivity of push/load, and timeout. This goes beyond the minimal annotation info, but could be more explicit about side effects like cache creation or long execution.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a purpose paragraph followed by parameter definitions. It is somewhat lengthy due to the large number of parameters, but every sentence adds value. Front-loading with purpose and usage is effective.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (24 parameters, nested objects, no output schema), the description covers essential aspects: return format, limitations (no stdin, no glob expansion), timeout default, and parameter behaviors. It does not mention dependencies like Docker daemon, but that is implicit. Overall, quite comprehensive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description carries full burden. It provides detailed descriptions for all 24 parameters, explaining their CLI mapping, constraints (e.g., 'no ~/glob expansion' for context, 'stdin not supported'), and default behavior. This adds substantial meaning beyond the schema's type and required fields.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states 'Build an image with BuildKit via `docker buildx build`' and lists specific features that differentiate it from the legacy `build_image` tool, such as multi-platform, cache export, attestations, secrets, and multi-stage builds. This provides a specific verb+resource and distinguishes from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says 'Replaces the legacy `build_image` tool when you need any of:' followed by a list of features, giving clear guidance on when to use this tool. However, it does not compare to other sibling tools like `buildx_bake` or mention when not to use it (e.g., for simple builds). Overall, good context but not exhaustive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/GavinLucas/docker-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server