Skip to main content
Glama

image_build

Build a Docker image from a Dockerfile using the daemon's classic builder. Ideal for simple single-platform builds from a local build context.

Instructions

Build an image from a Dockerfile using the daemon's classic builder.

Use this for simple single-platform builds from a local context. For multi-platform builds, BuildKit cache export/import, or advanced build features prefer buildx_build. path must be a directory accessible on the host running this server (it is the build context sent to the daemon). dockerfile is normally relative to path; omit to use the default Dockerfile.

dockerfile is not confined to the context, despite the usual relative form: docker-py detects an absolute path, or a relative one escaping via .., reads that file from the server host's filesystem and injects its contents into the build. So it can read any file the server user can, like the other host-filesystem parameters (dest_path, from_file), and unlike them it is easy to mistake for a context-relative name. buildx_build's --file resolves differently again (against the CLI's working directory) - see its docstring.

Args: path: Build context directory path on the server host tag: Name and optional tag in "name:tag" format to apply to the built image quiet: Suppress verbose build output (final image id still returned) nocache: Ignore the layer cache and rebuild all layers rm: Remove intermediate containers on success pull: Always pull a newer version of each FROM base image before building forcerm: Remove intermediate containers even on build failure dockerfile: Dockerfile filename relative to path (default: "Dockerfile"); an absolute path or one containing ".." reads that file from the server host instead of the context buildargs: Build-time variables passed as --build-arg; dict of str to str container_limits: Resource limits for the build container, e.g. {"memory": 134217728} shmsize: Size of /dev/shm in bytes for build steps that need shared memory labels: Labels to set on the resulting image (dict of str to str) cache_from: List of image references to use as layer cache sources target: Stop at this named build stage (multi-stage Dockerfiles) network_mode: Network mode for RUN instructions during build (e.g. "host", "none") squash: Squash all new layers into one (experimental; requires daemon flag) extra_hosts: Additional /etc/hosts entries during build; dict of hostname to IP platform: Target platform, e.g. "linux/amd64" (single platform only; use buildx for multi) isolation: Isolation technology, passed to the daemon as given; platform-dependent, so not validated here (Windows documents "default", "process", "hyperv") use_config_proxy: Forward proxy env vars from Docker client config to build

Returns: dict: The built image's full inspect payload (as docker inspect)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
rmNo
tagNo
pathNo
pullNo
quietNo
labelsNo
squashNo
targetNo
forcermNo
nocacheNo
shmsizeNo
platformNo
buildargsNo
isolationNo
cache_fromNo
dockerfileNo
extra_hostsNo
network_modeNo
container_limitsNo
use_config_proxyNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.0.0

TDQS

A5/5.0
Behavior5/5

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

Annotations only declare readOnlyHint=false and destructiveHint=false. The description adds substantial behavioral detail: it uses the classic builder, describes the dockerfile path resolution quirk (absolute or '..' reads from server host filesystem), and specifies the return value (full inspect payload). This goes far beyond annotations, covering side effects and edge cases.

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

Conciseness5/5

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

Despite being long, the description is well-structured: purpose statement first, then usage guidance, then a focused caveat about dockerfile, then a bulleted Args list, and a Returns line. Every sentence earns its place; no filler or redundancy. The front-loading of purpose and routing guidance ensures key information is immediately visible.

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

Completeness5/5

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

For a tool with 20 parameters, no output schema, and minimal annotations, the description covers everything an agent needs: purpose, routing, parameter semantics, return type, and a security-relevant edge case. Nothing is left ambiguous, and the alternative tool is explicitly referenced. This is a model of completeness.

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 description coverage is 0%, so the description carries the entire burden. The Args section explains each of the 20 parameters with clear, non-tautological meaning (e.g., 'rm: Remove intermediate containers on success', 'shmsize: Size of /dev/shm in bytes'), and the special security note about dockerfile adds critical context. This fully compensates for the schema's lack of descriptions.

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?

The description opens with 'Build an image from a Dockerfile using the daemon's classic builder', which is a specific verb, resource, and implementation detail. It clearly distinguishes itself from buildx_build by explicitly stating it is for simple single-platform builds, so an agent can immediately tell which tool to use.

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

Usage Guidelines5/5

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

Explicitly states when to use this tool ('simple single-platform builds from a local context') and when to prefer the alternative ('multi-platform builds, BuildKit cache export/import, or advanced build features'). It also explains the dockerfile host-filesystem resolution difference vs buildx_build's --file, offering concrete routing guidance.

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

Deploy Server

Other Tools