aiskillstore/marketplace/container-hadolint
Claude Code and agent skill by aiskillstore/marketplace
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Author "aiskillstore" has blocked skill(s)
Dockerfile security linting and best practice validation using Hadolint with 100+ built-in rules aligned to CIS Docker Benchmark. Use when: (1) Analyzing Dockerfiles for security misconfigurations and anti-patterns, (2) Enforcing container image security best practices in CI/CD pipelines, (3) Detecting hardcoded secrets and credentials in container builds, (4) Validating compliance with CIS Docker Benchmark requirements, (5) Integrating shift-left container security into developer workflows, (6) Providing remediation guidance for insecure Dockerfile instructions.
Install
npx vskill@latest install aiskillstore/marketplace/container-hadolintSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as aiskillstore/marketplace/container-hadolint.
Dockerfile Security Linting with Hadolint
Overview
Hadolint is a Dockerfile linter that validates container build files against security best practices and the CIS Docker Benchmark. It analyzes Dockerfile instructions to identify misconfigurations, anti-patterns, and security vulnerabilities before images are built and deployed.
Hadolint integrates ShellCheck to validate RUN instructions, ensuring shell commands follow security best practices. With 100+ built-in rules mapped to CIS Docker Benchmark controls, Hadolint provides comprehensive security validation for container images.
Quick Start
Install Hadolint
Scan Dockerfile
Generate Report
Core Workflows
1. Local Development Scanning
Validate Dockerfiles during development:
Output Format:
When to use: Developer workstation, pre-commit validation, iterative Dockerfile development.
2. CI/CD Pipeline Integration
Automate Dockerfile validation in build pipelines:
GitHub Actions
GitLab CI
When to use: Automated security gates, pull request checks, deployment validation.
3. Configuration Customization
Create .hadolint.yaml to customize rules:
Use bundled templates in assets/:
assets/hadolint-strict.yaml- Strict security enforcement (CRITICAL/HIGH only)assets/hadolint-balanced.yaml- Balanced validation (recommended)assets/hadolint-permissive.yaml- Permissive for legacy Dockerfiles
When to use: Reducing false positives, organizational standards, legacy Dockerfile migration.
4. Security-Focused Validation
Enforce critical security rules:
Critical Security Rules:
- DL3000: Use absolute WORKDIR (prevents directory traversal)
- DL3001: Always use version pinning for package managers
- DL3002: Never switch to root USER in Dockerfile
- DL3020: Use COPY instead of ADD (prevents arbitrary URL fetching)
- DL3025: Use JSON notation for CMD/ENTRYPOINT (prevents shell injection)
See references/security_rules.md for complete security rule catalog with CIS mappings.
5. Multi-Stage Build Validation
Scan complex multi-stage Dockerfiles:
Common Multi-Stage Issues:
- Using same user across build and runtime stages
- Copying unnecessary build tools to production image
- Missing security hardening in final stage
- Secrets present in build stage propagating to runtime
When to use: Complex builds, security-hardened images, production containerization.
6. Pre-Commit Hook Integration
Prevent insecure Dockerfiles from being committed:
When to use: Developer workstations, team onboarding, mandatory security controls.
Security Considerations
Sensitive Data Handling
- Secret Detection: Hadolint flags hardcoded secrets in ENV, ARG, LABEL instructions
- Build Secrets: Use Docker BuildKit secrets (
RUN --mount=type=secret) instead of ARG for credentials - Multi-Stage Security: Ensure secrets in build stages don't leak to final image
- Image Scanning: Hadolint validates Dockerfile - combine with image scanning (Trivy, Grype) for runtime security
Access Control
- CI/CD Permissions: Hadolint scans require read access to Dockerfile and build context
- Report Storage: Treat scan reports as internal documentation - may reveal security practices
- Trusted Registries: Configure
trustedRegistriesto enforce approved base image sources
Audit Logging
Log the following for compliance and security auditing:
- Scan execution timestamps and Dockerfile paths
- Rule violations by severity (error, warning, info)
- Suppressed rules and justifications
- Base image registry validation results
- Remediation actions and timeline
Compliance Requirements
- CIS Docker Benchmark 1.6: Hadolint rules map to CIS controls (see
references/cis_mapping.md) - 4.1: Create a user for the container (DL3002)
- 4.6: Add HEALTHCHECK instruction (DL3025)
- 4.7: Do not use update alone in Dockerfile (DL3009)
- 4.9: Use COPY instead of ADD (DL3020)
- OWASP Docker Security: Validates against OWASP container security best practices
- NIST SP 800-190: Application container security guidance
Bundled Resources
Scripts (scripts/)
hadolint_scan.py- Comprehensive scanning with multiple Dockerfiles and output formatshadolint_multistage.py- Multi-stage Dockerfile analysis with stage-specific validationinstall_precommit.sh- Automated pre-commit hook installationci_integration.sh- CI/CD integration examples for multiple platforms
References (references/)
security_rules.md- Complete Hadolint security rules with CIS Benchmark mappingscis_mapping.md- Detailed CIS Docker Benchmark control mappingremediation_guide.md- Rule-by-rule remediation guidance with secure examplesshellcheck_integration.md- ShellCheck rules for RUN instruction validation
Assets (assets/)
hadolint-strict.yaml- Strict security configurationhadolint-balanced.yaml- Production-ready configuration (recommended)hadolint-permissive.yaml- Legacy Dockerfile migration configurationgithub-actions.yml- Complete GitHub Actions workflowgitlab-ci.yml- Complete GitLab CI pipelineprecommit-config.yaml- Pre-commit framework configuration
Common Patterns
Pattern 1: Initial Dockerfile Security Audit
First-time security assessment:
Pattern 2: Progressive Remediation
Gradual security hardening:
Pattern 3: Security-Hardened Production Image
Build security-first container image:
Validate with Hadolint:
Pattern 4: CI/CD with Automated Remediation Suggestions
Provide actionable feedback in pull requests:
Integration Points
CI/CD Integration
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/agentsecops/container-hadolint/SKILL.md
Popularity
- Repository stars
- 429
- Repository forks
- 45
- 7-day trend score
- 30
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aiskillstore/marketplace/container-hadolint)