Dockerfile Check

Reads a Dockerfile the way BuildKit does and flags images that run as root, bake in secrets or rebuild slowly.

StopsDocker image runs as root with secrets

Installation

pnpm dlx shadcn@latest add https://bollard-ui.vercel.app/r/dockerfile-check.json

The files land in your project. They're yours to edit.

Usage

dockerfile-check-usage.tsx
import { DockerfileCheck } from "@/components/ui/dockerfile-check"

return <DockerfileCheck defaultValue={DOCKERFILE} dockerignore={null} />

What it catches

  • A final stage that runs as root
  • Secrets in ARG or ENV, and secret files copied in or carried by COPY --from
  • COPY . before dependency install (slow rebuilds) and a missing .dockerignore
  • apt-get without -y, --no-install-recommends or list cleanup
  • ADD from a URL without --checksum, curl | sh and shell-form CMD

Props

DockerfileCheck props
PropTypeDefault
value

Controlled Dockerfile text.

string—
defaultValue

Initial text when uncontrolled.

string""
onValueChange

Called with the new text on every edit or fix.

(value: string) => void—
dockerignore

The project's .dockerignore: its text, `null` if there is none, or leave out when unknown.

string | null—
label

Visible label; shorthand for `messages.label`.

string—
messages

Every visible string. `{line}`, `{detail}`, `{key}`, `{file}`, `{command}` and friends are filled in.

Partial<DockerfileCheckMessages>—

* required. Also accepts the native props of <textarea> (className, aria-*, data-*…), passed through to it.

Accessibility

  • Visible <label>; aria-invalid and aria-describedby to a role="status" summary
  • Jumping to a finding focuses the textarea at that line
  • After a fix, focus moves to the next fix or back to the field

Only what the source does. Test with your own screen reader and content before shipping.

Limitations

This is a UX guard rail. Enforce on the server: Run image scanning and policy checks in CI; this check doesn't see the built image.

  • Static reading of the file; it doesn't build the image or scan installed packages
  • Base-image vulnerabilities are out of scope

What it stops

Docker image runs as root with secrets

Also known as

dockerfile · docker · buildkit · container · hadolint · multi-stage · devops · image

Dependencies

Pairs well with