Skip to main content
Glama

build_image

Build a Docker image from a Dockerfile using the classic builder. Specify the build context directory and tag, with options to control caching, pull, and resource limits.

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 relative to path; omit to use the default Dockerfile.

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 (default True) 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") buildargs - Build-time variables passed as --build-arg; dict of str→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 apply to the resulting image; dict of str→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→ip platform - Target platform, e.g. "linux/amd64" (single platform only; use buildx for multi) isolation - Windows isolation technology ("default", "process", "hyperv") use_config_proxy - Forward proxy env vars from Docker client config to build returns: dict - The built image's attrs

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
Behavior5/5

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

Annotations are minimal (readOnlyHint=false, destructiveHint=false). The description compensates by detailing behavioral traits: classic builder, effects of options like 'squash' being experimental, default of 'rm', and that it returns the built image's attrs. No contradictions with annotations.

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 (purpose first, then usage, then parameter list). It is somewhat long due to 20 parameters, but each sentence is necessary. A slight redundancy exists (e.g., 'returns' could be integrated), but overall efficient.

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?

Given the tool's complexity (20 params, nested objects, 0% schema coverage, no output schema), the description is comprehensive. It covers usage context, parameter semantics, and return type. No gaps remain.

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 bears full burden. It lists all 20 parameters with detailed explanations, including types and notes (e.g., 'buildargs' as dict of str→str, 'platform' single platform only). This adds substantial meaning beyond the schema.

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 explicitly states 'Build an image from a Dockerfile using the daemon's classic builder.' It distinguishes from sibling 'buildx_build' by clarifying this tool is for simple single-platform builds, while the sibling is for multi-platform and advanced features.

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?

The description provides clear guidance: 'Use this for simple single-platform builds... For multi-platform builds... prefer buildx_build.' It also notes that 'path' must be accessible on the host and explains the default for 'dockerfile'.

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