Dockerfile Linter
Check your Dockerfile against 15 security and best practice rules. Get a score, grade, and concrete suggestions to fix every issue found.
Paste your Dockerfile above and click ‘Lint Dockerfile’
15 rules checked · security · size · best practices
A Dockerfile linter analyses your Dockerfile against a ruleset of security guidelines and best practices, flagging issues before they end up in a production image. Writing a working Dockerfile is straightforward — writing one that is secure, small, and efficient requires knowing dozens of best practices that are easy to overlook under deadline pressure.
Common Dockerfile mistakes include using the latest tag (which silently pulls breaking changes on the next build), running the container as root (which gives any exploit full system access inside the container), installing packages without cleaning the apt cache (which bloats the image), and hardcoding secrets like API keys and passwords directly in ENV instructions (which embeds them permanently in every image layer). Our Dockerfile best practices checker catches all of these and more, scoring your file from 0 to 100 and assigning a letter grade.
The linter checks fifteen rules covering security, image size optimisation, and correctness. Each issue includes the exact line number, a severity level (error, warning, or informational), and a concrete suggestion showing the corrected syntax. The score calculation weights errors heavily — a single hardcoded secret deducts 15 points — so the grade reflects real risk, not just style preferences.
The tool runs completely in your browser via an API call to a serverless function — your Dockerfile content is processed and immediately discarded, never stored. It is an alternative to running hadolint locally and requires no Docker installation, no CLI tools, and no configuration.
How to Use the Dockerfile Linter
- 1
Paste your Dockerfile content
Open your Dockerfile in any text editor, select all (Ctrl+A), copy, and paste into the text area. Alternatively click "Load Example" to see a sample Dockerfile with intentional issues that demonstrates what the linter catches.
- 2
Click Lint Dockerfile
The tool sends your Dockerfile to the linter API, which parses it line by line and runs all fifteen rule checks. Results appear within a second.
- 3
Review your score and grade
The summary card shows your score out of 100 and a letter grade (A+ to F). Below it, issues are listed sorted by severity — errors first, then warnings, then informational suggestions.
- 4
Read each issue and suggestion
Each issue card shows the line number, the rule that fired, a plain-English message explaining the problem, and a highlighted suggestion box with the correct syntax or approach to fix it.
- 5
Fix issues and re-lint
Apply the suggestions to your Dockerfile, paste the updated content, and lint again. Iterate until you reach an A or A+ grade before building and pushing the image.
Understanding Dockerfile Lint Results
error represents a security risk or correctness problem that should always be fixed, a warning is a significant best practice violation that impacts security or image size, and info is an optimisation suggestion that improves the image but may not apply to every project.
The Score starts at 100 and deducts 15 points per error, 8 points per warning, and 3 points per informational finding, with a floor of 0. The Grade maps the score to a letter: A+ (90–100), A (80–89), B (70–79), C (50–69), and F (below 50). A file with one hardcoded secret (−15) and three warnings (−24) would score 61 — a C grade — even with no other issues.| Field | Description |
|---|---|
| Line | The 1-based line number in your Dockerfile where the issue was detected. |
| Severity | error = security/correctness risk; warning = best practice violation; info = optimisation suggestion. |
| Rule | A short machine-readable identifier for the rule that fired (e.g. latest-tag, root-user, exposed-secrets). |
| Message | A plain-English description of what the linter found and why it is a problem. |
| Suggestion | A concrete fix showing the corrected Dockerfile syntax or approach to resolve the issue. |
| Score | A 0–100 numeric score. Start at 100, subtract 15 per error, 8 per warning, 3 per info finding. |
| Grade | A+ (90–100), A (80–89), B (70–79), C (50–69), F (0–49). |
Common Dockerfile Linting Use Cases
Security audit before pushing to a registry
Run the linter before every docker build and push. Catch hardcoded secrets, root user configurations, and exposed sensitive files before they land in your image registry and get deployed to production where they become a live vulnerability.
Reduce image size for faster deploys
Bloated images slow down CI/CD pipelines, increase pull times in Kubernetes, and cost more storage. The linter flags uncleaned apt caches, unchained RUN commands that add unnecessary layers, and opportunities to introduce multi-stage builds.
Onboarding and code review
Share the linter link with new engineers learning Docker. Paste a Dockerfile from a pull request and instantly explain why a specific pattern is problematic — the rule names and suggestions provide a structured teaching moment faster than a written comment.
Enforce standards across multiple projects
Run the Dockerfile linter as part of CI. If the score drops below a threshold (e.g. grade B or lower), fail the build. This enforces consistent quality standards across all teams and Dockerfiles in your organisation without manual review.