Dockerfile Lint

v0.3.0
io.github.basitalisandhu/mcp-dockerfile-lint Checked 15 hours ago Published 1 month ago

Lint Dockerfiles for root users, latest tags, secrets in ENV or ARG, missing HEALTHCHECK and more.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

lint_dockerfile Lint a Dockerfile

Parse a Dockerfile (comments, escape directive, line continuations, heredocs, multi-stage builds) and return findings sorted by severity with line numbers and fixes. Checks: final stage running as root, base images without a tag or with :latest, images without a digest, credential-like names in ENV or ARG, credential literals in RUN, missing HEALTHCHECK, apt-get install without list cleanup or --no-install-recommends, apt-get upgrade, apk add without --no-cache, pip without --no-cache-dir, ADD for plain files or remote URLs, curl piped to a shell, sudo, relative WORKDIR, repeated CMD or ENTRYP…

ParameterTypeDescription
contentstringDockerfile text. Alternative to path.
dockerignorestringInline .dockerignore text; overrides the sibling file, including when empty.
ignorearrayRule ids to skip.
pathstringPath to a local Dockerfile (up to 1048576 bytes).

parse_dockerfile Parse a Dockerfile

Return the Dockerfile's instructions in order (instruction keyword, arguments with continuations joined, start and end line, stage index) and its build stages (index, AS name, base image, line), plus the escape character in effect.

ParameterTypeDescription
contentstringDockerfile text. Alternative to path.
pathstringPath to a local Dockerfile (up to 1048576 bytes).

explain_rule Explain a lint rule

Describe one lint rule: its default severity, what it detects and how to fix it. Rules: root-user, latest-tag, unpinned-digest, secret-in-env, secret-in-arg, secret-literal, no-healthcheck, apt-no-cleanup, apt-no-recommends, apt-upgrade, apk-no-cache, pip-no-cache, add-for-copy, add-remote, curl-pipe-shell, sudo, workdir-relative, multiple-cmd, shell-form-cmd, expose-ssh, maintainer-deprecated, copy-whole-context, copy-chown-missing, empty-dockerfile, from-missing.

ParameterTypeDescription
rule *string