# Dockerfile Lint

> Dockerfile Lint is an open-source MCP server for developer tools. Lint Dockerfiles for root users, latest tags, secrets in ENV or ARG and more. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Linux, macOS, Windows
- **Website:** https://basitalisandhu.github.io/dev-mcp-servers/
- **Repository:** https://github.com/basitalisandhu/dev-mcp-servers/tree/HEAD/packages/dockerfile-lint
- **MCP Registry name:** io.github.basitalisandhu/mcp-dockerfile-lint
- **Categories:** developer tools, security
- **Listing updated:** 2026-11-14

## About

This server does static analysis only and never invokes Docker. It parses Dockerfiles including comments, the escape directive, line continuations, heredocs and multi-stage builds, then reports findings with a rule id, severity, line and fix. Rules cover a final stage running as root, missing or latest tags, credential-like ENV and ARG names, a missing HEALTHCHECK, apt-get without cleanup, curl piped to sh, EXPOSE 22, COPY . . without sensible ignore coverage, and others.

A separate parse tool returns instructions with line ranges and stage names, and an explain tool describes a single rule. It also reads the sibling .dockerignore (up to 64 KB) to decide whether the copy-whole-context warning applies. The README is candid that the rules are text heuristics and a clean result does not scan the image's packages.

It runs over stdio from a pinned Docker image that sees only the directory you mount, makes no network requests and sends no telemetry.

## Features

- **Production-focused rules:** Flags root users, latest tags, missing digests and health checks.
- **Secret detection:** Catches credential-like ENV and ARG names and literals.
- **Package manager hygiene:** Checks apt-get, apk and pip flags.
- **Dockerfile parsing:** Returns instructions, stages and base images.
- **Rule explanations:** Gives severity, description and fix for one rule.
- **Dockerignore awareness:** Considers .dockerignore coverage for .git, .env and node_modules.

## Good for

- Review a Dockerfile before opening a pull request
- Find why a multi-stage build runs as root
- Check a base image reference for pinned tags
- Understand a lint rule and its fix

## Install

### Claude Code (Terminal)

```sh
claude mcp add mcp-dockerfile-lint -- docker run -i --rm ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-dockerfile-lint": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "mcp-dockerfile-lint": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "mcp-dockerfile-lint": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "mcp-dockerfile-lint": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-dockerfile-lint": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0"
      ]
    }
  }
}
```

## Tools

- `lint_dockerfile`: Lint a Dockerfile and return findings with fixes.
- `parse_dockerfile`: Parse instructions, stages and base images.
- `explain_rule`: Explain one lint rule.

## FAQ

### Does it need Docker to lint?

No. It is static analysis and Docker is never invoked; the server itself ships as a container.

### Does it scan image packages?

No. A clean result only means the text rules passed.

### What files does it read?

The Dockerfile you name (up to 1 MB) and its .dockerignore (up to 64 KB).

### Is it on npm?

Not yet, according to the README; use the pinned GHCR image.

### Is Dockerfile Lint free?

Yes. Dockerfile Lint is open source, so you can use and self-host it for free.

### How do I add Dockerfile Lint to Claude Code?

Run this command in your terminal: claude mcp add mcp-dockerfile-lint -- docker run -i --rm ghcr.io/basitalisandhu/mcp-dockerfile-lint:0.3.0

### What are the best alternatives to Dockerfile Lint?

The closest alternatives to Dockerfile Lint are REA, Codebase Memory, GitHub, Serena MCP: the IDE for your agent and XERJ.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Ouroboros](https://ai-powered.com/mcp/ouroboros): Ouroboros is an open-source MCP server for developer tools.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Concord MCP](https://ai-powered.com/mcp/concord-mcp): Concord MCP is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/dockerfile-lint
