pip install dockerdna Open Source CIS Docker Benchmark v1.6 CycloneDX 1.5 SBOM SARIF 2.1.0 MIT License

Container security at the
DNA level

Pre-build container security analysis: secrets detection with Shannon entropy analysis, docker-compose.yml auditing, CIS Docker Benchmark v1.6 control mapping, supply-chain risk scoring, CycloneDX SBOM, and SARIF output — with layer-by-layer attribution on every finding.

Built with
Python 3.11+
PyYAML
CIS v1.6
CycloneDX 1.5
SARIF 2.1.0
Anthropic Claude
31
Tests Passing (pytest)
20+
Secret Pattern Signatures
20
CIS Docker Benchmark Controls Checked
4
Output Formats (JSON, HTML, SARIF, SBOM)
What it does

Pre-build container security, end to end

DockSec, Trivy, and Hadolint are strong tools and each has grown real coverage of its own (DockSec now scans docker-compose, ships SARIF/SBOM/CI gating; Trivy has a dedicated secrets scanner). DockerDNA focuses specifically on pre-build analysis with a few things not documented elsewhere in this space.

docker-compose.yml auditing

Privileged mode, Docker socket mounts, missing resource limits, and host networking are parsed directly out of your compose file and mapped to CIS Docker Benchmark Section 5.

Dual-mode secrets detection

20+ regex patterns for known formats (AWS, GCP, GitHub, Stripe, JWT, DB URIs…) plus Shannon entropy analysis to catch unknown, custom, or rotated credentials that no regex list covers.

CIS control-ID mapping

Every finding is tagged with its specific CIS Docker Benchmark v1.6 control ID (not just a severity bucket), and rolled up into a pass/fail/not-checked scorecard with a 0–100% score.

Layer-by-layer attribution

Every finding is traced back to the exact instruction and build stage that introduced it, including secrets that leak across multi-stage builds.

SARIF for the Security tab

SARIF 2.1.0 output ships by default, so findings annotate pull requests directly in the GitHub Security tab with zero additional integration.

CycloneDX SBOM

Parses every apt-get, pip, npm, apk, and yum install instruction to produce a CycloneDX 1.5 BOM with PURL identifiers and per-layer attribution.

The four-scanner pipeline
1

Secrets Engine — Regex + Shannon Entropy

Scans Dockerfiles, docker-compose.yml, .env files, and any project files. Pattern matching covers 20+ known secret formats (AWS, GCP, GitHub, Stripe, JWT, DB URIs…). Entropy analysis with threshold ≥ 4.5 bits/char catches unknown high-entropy tokens that regex never will.

H(X) = -∑ p(x) log₂ p(x)  →  flag if H ≥ 4.5 and length ≥ 20 chars.

2

docker-compose.yml Scanner — CIS Section 5

Parses every service definition in YAML. Checks for privileged: true, cap_add: [ALL], Docker socket volume mounts, network_mode: host, missing memory/CPU limits, missing read_only, missing no-new-privileges, missing AppArmor profile, and hardcoded env secrets. Every finding is tagged with its CIS Docker Benchmark v1.6 control ID.

3

Dockerfile + Supply Chain Scanner — Layer Attribution

Parses the Dockerfile layer-by-layer. Detects :latest tags without digest pinning, unnecessary packages (curl, vim, gcc…), missing USER and HEALTHCHECK, secrets leaking across multi-stage builds, and SSH server installation. Each FROM image receives a 0–100 supply chain risk score based on registry trust, tag specificity, and Docker Content Trust status.

4

CIS Compliance Mapper + Report Generation

All findings are aggregated and mapped to CIS Docker Benchmark v1.6 controls. A pass/fail scorecard is produced. Reports are written in all requested formats: JSON (full structured data), HTML (interactive dashboard), SARIF 2.1.0 (GitHub Security tab), and CycloneDX 1.5 SBOM. A CI threshold gate (--threshold HIGH) exits with code 1 if findings at that severity or above are present.


Architecture

Five scanners. One unified report.

DockerDNA runs all sub-scanners in sequence and assembles findings into a single structured report before writing output formats.

  Dockerfile          docker-compose.yml      .env / project files
      |                       |                        |
      v                       v                        v
+---------------------+ +-----------------+ +--------------------+
|  DockerfileScanner  | | ComposeScanner  | |  SecretsScanner    |
|  - Layer parsing    | | - CIS Sect. 5   | |  - 20+ regex pats  |
|  - CIS Sect. 4      | | - Env secrets   | |  - Shannon entropy |
|  - Multi-stage leak | | - Resource lims | |  - Redaction       |
+---------------------+ +-----------------+ +--------------------+
          |                      |                     |
          +----------+           |          +----------+
                     |           |          |
                     v           v          v
               +-----------------------------------+
               |        SupplyChainScanner         |
               |  - Registry trust scoring         |
               |  - Digest pinning check           |
               |  - DOCKER_CONTENT_TRUST           |
               +-----------------------------------+
                              |
                              v
               +-----------------------------------+
               |         ComplianceMapper          |
               |  - CIS Docker Benchmark v1.6      |
               |  - Pass / Fail / Not-Checked      |
               |  - 0-100 compliance score         |
               +-----------------------------------+
                              |
          +-------------------+-------------------+
          |                   |                   |
          v                   v                   v
     report.json         report.html         report.sarif
     (full data)      (dashboard UI)    (GitHub Security tab)
                                               |
                                               v
                                    sbom.cyclonedx.json
                                      (CycloneDX 1.5)
                                               |
                                               v (optional)
                                      AI Remediation
                                    (Anthropic Claude)
🔑

secrets.py — Dual-Mode Detection

Two complementary strategies: compiled regex for 20+ known secret formats, and Shannon entropy analysis for unknown high-entropy tokens. Values are automatically redacted in reports.

aws-keys github-tokens jwt db-uris entropy≥4.5
📦

compose.py — Runtime Misconfig Scanner

YAML parser covering every CIS Section 5 control: privileged mode, capability escalation, Docker socket mounts, host networking, missing resource limits, read-only filesystem, and no-new-privileges.

CIS-5.3 CIS-5.4 CIS-5.9 CIS-5.13 CIS-5.14
🔗

supply_chain.py — Risk Scoring

Every FROM image receives a 0–100 supply chain risk score based on registry trust (official vs community vs self-hosted), digest pinning, Docker Content Trust status, and malicious image name patterns.

CIS-4.5 digest-pinning registry-trust content-trust
📋

compliance.py — CIS Scorecard

Aggregates all scanner findings and maps them to CIS Docker Benchmark v1.6 controls. Produces a full pass/fail/not-checked scorecard and a 0–100% compliance percentage.

CIS-4.1 CIS-4.6 CIS-4.9 CIS-4.10 20 controls
📜

sbom.py — CycloneDX SBOM

Parses every package manager install instruction (apt-get, pip, npm, apk, yum) to produce a CycloneDX 1.5 BOM with PURL identifiers, layer attribution, and build-stage annotations. NTIA minimum-elements compliant.

cyclonedx-1.5 purl apt-get pip npm
🔌

sarif.py — GitHub Security Tab

SARIF 2.1.0 output maps every finding to a rule with severity, help URI, and source location. Upload to GitHub Advanced Security to get inline PR annotations — zero additional integration required.

sarif-2.1.0 github-adv-security pr-annotations oasis-tcs

Detection coverage

What DockerDNA finds

Findings across five scanners, mapped to CIS Docker Benchmark v1.6 controls.

🔐

Hardcoded Secrets

AWS access keys, Google API keys, GitHub tokens, Stripe keys, JWT tokens, RSA private keys, database connection strings, and 15+ more patterns. Plus Shannon entropy detection for unknowns.

⚠

Privileged Containers

privileged: true and cap_add: [ALL] in docker-compose give a container unrestricted kernel access. CIS-5.4 and CIS-5.3. Flagged with specific remediation steps.

🔄

Docker Socket Mounts

Mounting /var/run/docker.sock gives a container full control over the Docker daemon — equivalent to root on the host. CIS-5.13. Flagged as CRITICAL.

👤

Root Container Execution

Containers without a non-root USER instruction run as UID 0. If the application is compromised, the attacker has root inside the container. CIS-4.1.

🏭

Supply Chain Risks

Base images without digest pinning, using Docker Hub community images, or without Docker Content Trust enabled receive elevated risk scores. CIS-4.2 and CIS-4.5.

📋

Multi-Stage Secret Leaks

Secrets set in ENV or ARG in early build stages may survive into the final image layer history. DockerDNA detects this pattern across all stages and warns before the image is built.

💸

Missing Resource Limits

Containers without memory or CPU limits can consume all host resources, causing denial of service for other workloads. CIS-5.10 and CIS-5.11.

🔌

Missing Security Controls

No HEALTHCHECK (CIS-4.6), no read-only root filesystem (CIS-5.12), no no-new-privileges (CIS-5.14), no AppArmor profile (CIS-5.1). All flagged with CIS control IDs and remediations.

🔬

Unnecessary Packages

curl, wget, vim, gcc, gdb, strace, openssh-server, and 10+ other tools that expand the attack surface when present in production images. CIS-4.3.


Comparison

DockerDNA vs existing tools

Verified against each project's public documentation, September 2026. Tools evolve quickly — always check upstream docs before relying on this. Cells marked “not documented” mean I could not confirm the capability either way, not that it's absent.

Capability DockerDNA OWASP DockSec Trivy Hadolint
Dockerfile security scan ✓ ✓ partial (image/IaC scan) ✓
docker-compose.yml scanner ✓ ✓ not documented ✗
Secrets detection ✓ regex + entropy ✓ via Trivy ✓ regex, built-in rules ✗
Entropy detection for unknown secrets ✓ not documented ✗ regex-only ✗
CIS Docker Benchmark control-ID mapping ✓ v1.6 not documented ✗ ✗
SBOM generation (CycloneDX) ✓ 1.5 ✓ ✓ ✗
SARIF output ✓ 2.1.0 ✓ ✓ ✗
Supply chain image risk scoring ✓ 0–100 not documented CVE-based ✗
Multi-stage build secret leak detection ✓ not documented ✗ ✗
CI/CD threshold gate ✓ --threshold ✓ --fail-on ✓ ✗
Layer-by-layer finding attribution ✓ not documented ✗ ✗
AI-powered remediation ✓ Claude ✓ Multi-LLM ✗ ✗
CVE vulnerability database — ✓ via Trivy ✓ ✗

DockerDNA is designed to complement tools like DockSec and Trivy, not replace them. If you already use DockSec for its multi-LLM explanations and automated patching, or Trivy for CVE scanning, DockerDNA is a good addition for pre-build compose/secrets/compliance analysis.


Installation

Get started in 30 seconds

Install via pip, point at your Dockerfile or project directory, get results in JSON, HTML, SARIF, and SBOM. View on PyPI →

● 1. Install
pip install dockerdna

# With AI remediation
pip install "dockerdna[ai]"
Requires Python 3.11+. PyYAML is the only non-stdlib dependency for core scanning.
● 2. Scan your project
dockerdna Dockerfile \
  --compose docker-compose.yml \
  --format json html sarif sbom
Output written to ./dockerdna-results/. HTML report includes an interactive CIS compliance scorecard.
● 3. CI/CD gate
dockerdna Dockerfile \
  --compose docker-compose.yml \
  --threshold HIGH \
  --format sarif
Exits with code 1 if any CRITICAL or HIGH findings are present. Use in GitHub Actions to block unsafe PRs.
● 4. AI remediation
export ANTHROPIC_API_KEY=sk-...
dockerdna Dockerfile \
  --compose docker-compose.yml \
  --ai --format json html
Claude synthesises findings from all five scanners and produces a prioritised fix plan with corrected Dockerfile and compose file.
GitHub Actions integration
● .github/workflows/security.yml
- uses: actions/checkout@v4
- run: pip install dockerdna

- name: Run DockerDNA
  run: |
    dockerdna Dockerfile \
      --compose docker-compose.yml \
      --format sarif json \
      --threshold HIGH \
      --output dockerdna-results

- name: Upload to GitHub Security tab
  uses: github/codeql-action/upload-sarif@v3
  if: always()
  with:
    sarif_file: dockerdna-results/report.sarif
SARIF findings appear as inline annotations on pull requests in the GitHub Security tab. No additional configuration required.
Sample output — vulnerable example
● dockerdna Dockerfile.vulnerable --compose docker-compose.vulnerable.yml
  Risk Score     : 100/100
  CIS Compliance : 0.0%
  Total Findings : 44

  CRITICAL    8
  HIGH       12
  MEDIUM     17
  LOW         7

  [CRITICAL] CIS-4.9  ENV PASSWORD: supe****t123
  [CRITICAL] CIS-4.9  ENV API_KEY: AIza****3456
  [CRITICAL] CIS-5.4  webapp: Privileged mode enabled
  [CRITICAL] CIS-5.13 webapp: Docker socket mounted
  [HIGH]     CIS-4.1  No non-root USER instruction
  [HIGH]     CIS-5.9  webapp: network_mode: host
  [HIGH]     CIS-5.3  webapp: cap_add: [ALL]
Secret values are redacted by default (--no-redact to disable). Full HTML report with CIS compliance scorecard written to dockerdna-results/report.html.
Community

Star history

Track DockerDNA's growth on GitHub.

Star History Chart

Find risky Docker configs before you ship ⭐

A star helps DevSecOps engineers, Docker security researchers, and platform teams find this work. If DockerDNA catches something real in your stack, open an issue and let us know.

★  Star on GitHub Open an issue Read the docs
Author

Built by

SG
Sunil Gentyala, Independent Researcher
IEEE Senior Member  ·  Security Researcher
sunil.gentyala@ieee.org