Dockerfile — 18 Operations for AI Agents

Every container starts as a Dockerfile, and every Dockerfile encodes build order, base images, and supply-chain choices. act101 surfaces that structure directly, so agents reason about stages and layers instead of scrolling raw build scripts.

This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Dockerfile code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.

18Query

Worked Dockerfile examples

act101 reads a Dockerfile's FROM instructions as module declarations named for the base image's repository — the tag and the AS <stage> alias are both dropped from the name — and reads ARG/ENV instructions as variable declarations named for the variable. symbols covers the identical set of instructions but reports the FROM entries as kind: class rather than module, while ARG and ENV keep kind: variable in both queries. The unit of structure in this grammar is the instruction line: WORKDIR, RUN, COPY, EXPOSE, HEALTHCHECK, and ENTRYPOINT are not read at all, so a build stage's steps and its final image configuration are invisible to both queries. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.

Read the build stages and variables as a skeleton

captioner.dockerfile builds a speech-to-caption service across three stages: a golang builder compiles the CLI, a python stage installs faster-whisper and stages the model weights, and a debian runtime stage assembles the final image around a MODEL_PATH argument and environment variable.

$ act query skeleton captioner.dockerfile

Before

FROM golang:1.22 AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o /out/captioner ./cmd/captioner

FROM python:3.11-slim AS model
WORKDIR /model
RUN pip install --no-cache-dir faster-whisper==1.0.1
COPY models/tiny.en.bin ./tiny.en.bin

FROM debian:bookworm-slim
ARG MODEL_PATH=/opt/models/tiny.en.bin
ENV MODEL_PATH=${MODEL_PATH}
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
COPY --from=builder /out/captioner /usr/local/bin/captioner
COPY --from=model /model/tiny.en.bin ${MODEL_PATH}
EXPOSE 8080
HEALTHCHECK --interval=30s CMD curl -f http://localhost:8080/healthz || exit 1
ENTRYPOINT ["captioner"]

Output

{
    "type": "Skeleton",
    "declarations": [
        {
            "kind": "module",
            "name": "golang",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 1,
                    "byte_offset": 0
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 28,
                    "byte_offset": 27
                }
            },
            "name_range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 6,
                    "byte_offset": 5
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 12,
                    "byte_offset": 11
                }
            }
        },
        {
            "kind": "module",
            "name": "python",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 1,
                    "byte_offset": 140
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 31,
                    "byte_offset": 170
                }
            },
            "name_range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 6,
                    "byte_offset": 145
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 12,
                    "byte_offset": 151
                }
            }
        },
        {
            "kind": "module",
            "name": "debian",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 1,
                    "byte_offset": 278
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 26,
                    "byte_offset": 303
                }
            },
            "name_range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 6,
                    "byte_offset": 283
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 12,
                    "byte_offset": 289
                }
            }
        },
        {
            "kind": "variable",
            "name": "MODEL_PATH",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 1,
                    "byte_offset": 304
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 39,
                    "byte_offset": 342
                }
            },
            "name_range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 5,
                    "byte_offset": 308
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 15,
                    "byte_offset": 318
                }
            }
        },
        {
            "kind": "variable",
            "name": "MODEL_PATH",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 1,
                    "byte_offset": 343
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 29,
                    "byte_offset": 371
                }
            },
            "name_range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 5,
                    "byte_offset": 347
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 15,
                    "byte_offset": 357
                }
            }
        }
    ]
}

The skeleton reports golang, python, and debian as module declarations, one per FROM line, dropping their tags and AS aliases; MODEL_PATH appears twice as a variable, once for the ARG declaration and once for the ENV line that reads it back.

List the same instructions as symbols

The runtime stage declares MODEL_PATH as a build argument before exporting it as an environment variable for the captioner binary to read.

$ act query symbols captioner.dockerfile

Before

FROM golang:1.22 AS builder
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o /out/captioner ./cmd/captioner

FROM python:3.11-slim AS model
WORKDIR /model
RUN pip install --no-cache-dir faster-whisper==1.0.1
COPY models/tiny.en.bin ./tiny.en.bin

FROM debian:bookworm-slim
ARG MODEL_PATH=/opt/models/tiny.en.bin
ENV MODEL_PATH=${MODEL_PATH}
RUN apt-get update && apt-get install -y ffmpeg && rm -rf /var/lib/apt/lists/*
COPY --from=builder /out/captioner /usr/local/bin/captioner
COPY --from=model /model/tiny.en.bin ${MODEL_PATH}
EXPOSE 8080
HEALTHCHECK --interval=30s CMD curl -f http://localhost:8080/healthz || exit 1
ENTRYPOINT ["captioner"]

Output

{
    "type": "Symbols",
    "symbols": [
        {
            "name": "golang",
            "kind": "class",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 6,
                    "byte_offset": 5
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 1,
                    "column": 12,
                    "byte_offset": 11
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "python",
            "kind": "class",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 6,
                    "byte_offset": 145
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 8,
                    "column": 12,
                    "byte_offset": 151
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "debian",
            "kind": "class",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 6,
                    "byte_offset": 283
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 13,
                    "column": 12,
                    "byte_offset": 289
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "MODEL_PATH",
            "kind": "variable",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 5,
                    "byte_offset": 308
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 14,
                    "column": 15,
                    "byte_offset": 318
                }
            },
            "visibility": "unknown"
        },
        {
            "name": "MODEL_PATH",
            "kind": "variable",
            "range": {
                "start": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 5,
                    "byte_offset": 347
                },
                "end": {
                    "file": "captioner.dockerfile",
                    "line": 15,
                    "column": 15,
                    "byte_offset": 357
                }
            },
            "visibility": "unknown"
        }
    ]
}

symbols reports the same five entries as skeleton, but golang, python, and debian come back kind: class instead of module; the two MODEL_PATH entries keep kind: variable in both queries.

Query

18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.

callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch

← Django TemplatesDot/Graphviz →