droast - a dockerfile linter that actually has opinions
droast - a dockerfile linter that actually has opinions
・
docs ・ site ・ GH action ・ Wasmer ・ comparison ・ ☕
a dockerfile linter that actually has opinions. it catches bad practices and tells you about them in the least diplomatic way possible.
think of it as code review from a senior dev who's seen too many prod incidents and has stopped being polite about it.
the span-aware parser understands heredocs, parser and escape directives, shell and JSON forms, BuildKit flags such as RUN --mount, Windows paths, and PowerShell — and reports malformed Dockerfile syntax as DF071.
install from the marketplace and get inline squiggles as you type:
code --install-extension ImmanuelTikhonov.droastthe binary is bundled — no separate install needed. findings appear in real time with roast messages on hover.
Install the dependency-free Neovim plugin in one command; no plugin manager is required:
curl -fsSL https://raw.githubusercontent.com/immanuwell/dockerfile-roast/main/scripts/install-neovim-extension.sh | shOr use the dedicated droast.nvim repository with your preferred plugin manager:
-- lazy.nvim: { "immanuwell/droast.nvim" }
-- packer.nvim: use "immanuwell/droast.nvim"
-- mini.deps: MiniDeps.add({ source = "immanuwell/droast.nvim" })It starts automatically with droast on PATH, lint-on-save, and native
diagnostics. Override defaults with require("droast").setup({ args = { "--preset", "production" } }).
don't want to install anything? pick one:
Docker:
docker run --rm \
-v "$PWD:/workspace:ro" \
-w /workspace \
immanuwell/droast:1.7.0 \
--no-roast .replace . with Dockerfile to lint one file. The same image is also available from ghcr.io/immanuwell/droast.
Web: use the droast web linter. it runs in your browser.
Binary: download your platform binary from the latest release.
one-liner (macOS and Linux, detects Homebrew automatically):
curl -fsL ewry.net/droast/install.sh | shHomebrew (macOS and Linux):
brew install droastCargo (crates.io, builds from source):
cargo install dockerfile-roastEmbedding droast in a Rust tool? See the Rust library docs.
Wasmer (Wasmer Registry, sandboxed WASI command):
…bash droast fixes Dockerfile droast --fix --dry-run --format diff .
Apply every available safe fix, or select particular fixers:
```bash
droast --fix Dockerfile
droast --fix DF076,DF079 Dockerfile
…
bash
droast invocations .
droast invocations --format json .
…
toml
# droast.toml — all fields optional
preset = "production" # minimal | security | performance | production | strict
skip = ["DF012", "DF022"]
min-severity = "warning"
fail-on = "warning" # optional: make warnings fail CI
no-roast = true
[severity-overrides]
DF020 = "error"
[shellcheck]
mode = "auto" # off (default) | auto | required
exclude = ["SC2086"]
[workflow]
engine = "podman" # docker (default) | podman
…
bash
droast --config .lint/droast.toml DockerfileShared TOML files are also supported: place the same settings under
[tool.droast] (for example in pyproject.toml) and pass that file to
--config.
To migrate a Hadolint policy, generate an equivalent droast.toml from its YAML configuration:
droast init --from-hadolint .hadolint.yamlCompatible settings and Hadolint DL rule aliases are imported; Droast reports every setting or rule that has no equivalent so the migration stays reviewable.
Or replace a Hadolint invocation directly, without converting configuration:
droast --hadolint-compatible Dockerfile
…
dockerfile
# droast ignore=DF001 reason="PLAT-142 migration" expires=2026-09-30
FROM alpine:latestSee the complete configuration guide and the copy-paste examples/droast-enterprise.toml. None of these controls are required; zero-config behavior stays unchanged.
Optional message overrides add team guidance, migration links, or your own tone to terminal output. They do not change rules, exit codes, or JSON/SARIF/GitHub output.
# personal overrides in your OS config directory
droast messages init
# reviewed, shared overrides for this repository
droast messages init --projectEdit the generated YAML, then run droast again. It reads the file every time. See custom messages for layering, examples, placeholders, and validation.
add droast to any repo in 5 lines:
- uses: immanuwell/[email protected]full example (.github/workflows/lint.yml):
name: Lint Dockerfiles
on: [push, pull_request]
jobs:
droast:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: immanuwell/[email protected]
…
yaml
- uses: immanuwell/[email protected]
with:
files: '**/Dockerfile'
preset: production
skip: DF012,DF022
no-fail: true # report findings but don't block the PR
baseline: .droast-baseline.json
only-new: true # hide accepted findings; requires baselineroast Dockerfiles before they even reach CI, via pre-commit:
- repo: https://github.com/immanuwell/dockerfile-roast
rev: 1.7.0
hooks:
- id: droastthe hook runs on Dockerfile, Dockerfile.*, *.Dockerfile, *.dockerfile, Containerfile, and Containerfile.*, while excluding Dockerfile-specific .dockerignore files. pass flags through args as usual:
- id: droast
args: [--min-severity, warning, --skip, DF012]pull from Docker Hub (or use the identical GHCR image) and use immediately, no install needed:
# lint a Dockerfile in the current directory
docker run --rm -v "$(pwd)/Dockerfile":/Dockerfile immanuwell/droast /Dockerfile
# lint any file, anywhere
docker run --rm -v /path/to/your/Dockerfile:/Dockerfile immanuwell/droast /Dockerfile
# pass flags as usual
docker run --rm -v "$(pwd)/Dockerfile":/Dockerfile immanuwell/droast \
--no-roast --min-severity warning /Dockerfileor build locally from source:
docker build -t droast .
docker run --rm -v "$(pwd)/Dockerfile":/Dockerfile droast /Dockerfilethe image is published automatically to Docker Hub as immanuwell/droast and to GHCR as ghcr.io/immanuwell/droast on every release tag. Both registries receive the same version, major/minor, and latest tags.
the same OCI image works with rootless Podman. Mount the repository with :Z on SELinux hosts so Podman can relabel it for the container:
podman run --rm \
-v "$PWD:/workspace:Z" \
-w /workspace \
ghcr.io/immanuwell/droast \
--engine podman .--engine podman makes DF033 follow Podman’s .containerignore-before-.dockerignore precedence; it does not require a Podman daemon or change Dockerfile parsing. Persist that workflow for a repository with:
[workflow]
engine = "podman"Podman preprocesses Containerfile.in with CPP. Droast reports DF075 as an informational reminder to lint the generated Containerfile as part of that build workflow.
droast is also published as a WASI package in the Wasmer Registry. It uses the same CLI and rule engine as the native binary.
Lint through stdin without granting filesystem access:
wasmer run immanuwell/droast -- \
--check-dockerignore=false --format compact - ~/.zfunc/_droast
# fish — add to config.fish
droast completion fish | source85 rules, ngl thats a lot. run droast --list-rules for the full breakdown.
all 85 rules
Available Rules
ID SEVERITY CATEGORIES DESCRIPTION
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
DF001 WARN correctness,reproducibility Use specific base image tags instead of 'latest'
DF002 ERROR security Do not run as root
DF011 INFO performance Use multi-stage builds to reduce image size
DF013 ERROR security Avoid hardcoded credentials in RUN commands
DF014 ERROR security Avoid hardcoding passwords or tokens in ARG/ENV
DF020 INFO security Set explicit non-root USER
DF003 INFO performance Combine RUN commands to reduce layers
DF004 WARN performance Clean apt/apk cache before it reaches the final image
DF005 INFO correctness,reproducibility Pin package versions for reproducibility
DF006 WARN maintainability,performance Avoid ADD for local files; prefer COPY
DF007 WARN performance Do not copy the entire build context (COPY . .)
DF008 INFO maintainability,performance Use WORKDIR instead of inline cd commands
DF009 WARN correctness,maintainability Use absolute paths in WORKDIR
DF010 WARN security Avoid using sudo inside containers
DF012 INFO maintainability,reliability Set HEALTHCHECK for long-running services
DF017 WARN maintainability,reliability Use ENTRYPOINT with CMD for flexible images
DF018 WARN correctness,reliability Avoid using shell form for ENTRYPOINT
DF019 WARN correctness,maintainability Do not use deprecated MAINTAINER; use LABEL instead
DF022 INFO maintainability,reliability Specify EXPOSE for documented ports
DF023 INFO correctness,maintainability Name intermediate stages instead of relying on numeric indexes
DF024 WARN correctness,reproducibility Avoid using :latest in FROM even with aliases
DF025 WARN correctness,reliability Use JSON array syntax for CMD/ENTRYPOINT
DF026 WARN maintainability,performance Avoid broad local COPY to the filesystem root
DF030 INFO performance Avoid using pip without --no-cache-dir
DF031 INFO performance Avoid npm install without ci/--production for prod images
DF032 INFO maintainability,reliability Set PYTHONDONTWRITEBYTECODE and PYTHONUNBUFFERED for Python images
DF033 INFO performance,security Use an effective .dockerignore for each build context
DF034 ERROR security Avoid persistent world-writable chmod modes
DF035 INFO maintainability,reliability Avoid using curl without --fail flags
DF036 INFO maintainability,reliability Avoid Dockerfile with no CMD or ENTRYPOINT
DF015 ERROR correctness,reliability Avoid using apt-get without -y flag
DF016 INFO performance Use --no-install-recommends with apt-get
DF021 ERROR security,supply-chain Avoid executing unverified remote scripts
DF027 ERROR correctness,reliability Do not use yum without -y flag
DF028 WARN performance Cache-bust apt-get update
DF029 WARN performance Avoid apk add without --no-cache
DF037 ERROR correctness,No open issues yet, or sync has not completed.