dockerfile-validator

Validates, lints, and secures Dockerfiles with syntax and security checks.

9|Updated Feb 21, 2026
One-click install
npx skills add https://github.com/pantheon-org/tekhne --skill dockerfile-validator-pantheon-org
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dockerfile-validator
Source: https://github.com/pantheon-org/tekhne/tree/main/skills/infrastructure/dockerfile/validator
Command: npx skills add https://github.com/pantheon-org/tekhne --skill dockerfile-validator-pantheon-org

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve?

This Skill automates the validation, linting, and security analysis of Dockerfiles, ensuring they adhere to best practices, are optimized, and free from common vulnerabilities.

Core Features & Use Cases

  • Syntax Checking: Validates Dockerfile syntax using hadolint.
  • Security Scanning: Detects security misconfigurations and secrets using Checkov.
  • Best Practices: Enforces rules like non-root users, proper layer ordering, and cache cleaning.
  • Optimization Analysis: Identifies opportunities for image size reduction and build speed improvements.
  • Use Case: Before building a production Docker image, run this Skill to catch syntax errors, security risks like hardcoded secrets, and opportunities to reduce image size and build time.

Quick Start

Run the Dockerfile validator script on the current directory's Dockerfile.

Frequently Asked Questions about dockerfile-validator

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate Dockerfile syntax and check for security vulnerabilities?

You can validate Dockerfile syntax and check for security vulnerabilities by running automated linting and scanning, which detects misconfigurations, hardcoded secrets, and enforces best practices like non-root users.

What's the best way to optimize Docker image size and build speed?

The best way to optimize Docker image size and build speed is to analyze build layers, enforce proper layer ordering, and identify cache cleaning opportunities within your Dockerfile to streamline the production build process.

Does Dockerfile linting work with different variants like Dockerfile.prod and Dockerfile.dev?

Yes, Dockerfile linting works with all Dockerfile variants, including Dockerfile.prod and Dockerfile.dev, applying consistent syntax checking and security analysis across different environment configurations.

How do I check my Dockerfile for hardcoded secrets before building?

To check your Dockerfile for hardcoded secrets before building, run a security scan that detects embedded credentials and misconfigurations, ensuring your production images remain secure and compliant.

Why does my Dockerfile build fail layer ordering checks?

Your Dockerfile build may fail layer ordering checks because improper instruction sequencing reduces build cache efficiency and increases image size, requiring optimization analysis to enforce best practices.