Nadhebe

Dockerfile Linter

✓ Runs locally in your browser
Input Code
Ln: 1 Col: 1 0 chars
Output
 
Ready Ln: 1
Runs locally No uploads Free forever Open standards Fast Privacy first

What is a Dockerfile Linter?

The Dockerfile Linter takes raw Dockerfile text and analyzes it against best practices. It checks for pinned versions, proper layer caching, layer reduction, and security issues like running as root.

Examples

Example 1

Input: FROM ubuntu:latest\nRUN apt-get update\nRUN apt-get install curl
Output: Found 3 issues:\n1. Avoid using "latest" tag.\n2. Combine RUN instructions with &&.\n3. Missing apt-get cleanup.

The linter caught the unpinned version, uncombined RUN layers which bloat the image, and the missing package cache cleanup.

When to use Dockerfile Linter

  • Before committing Dockerfile changes to version control
  • During CI/CD pipelines to ensure Docker best practices
  • When trying to reduce the size of bloated Docker images
  • Before publishing containers to a public registry

Common Mistakes

Mistake: Using the "latest" tag in FROM instructions
Fix: Always pin your base images to a specific version (e.g., node:18.16.0) to ensure reproducible builds.
Mistake: Not cleaning up package managers after install
Fix: Run `rm -rf /var/lib/apt/lists/*` in the same RUN layer as `apt-get install` to reduce image size.

Frequently Asked Questions

Common questions about this tool.

Why should I lint my Dockerfiles?

Linting helps catch common mistakes, optimizes build caching, prevents image bloat, and flags security risks (like running as root or using outdated base images).

What rules are checked by this linter?

We check for latest tags, missing WORKDIR, improper ADD/COPY usage, multiple CMDs, un-chained RUN commands, missing EXPOSE, and missing cache cleanups after package installs.

Is my Dockerfile uploaded to a server?

No. The entire analysis runs locally in your web browser for complete privacy.

People Also Ask

  • How do I reduce my Docker image size?
  • What are Dockerfile best practices?
  • Why is my Docker build so slow?
  • Should I use ADD or COPY in Docker?

Related Free Utilities

View all tools →