Key Takeaways
- Trivy is the default open-source choice — fast, zero-config, covers OS packages + app dependencies + IaC + secrets in one binary.
- Grype + Syft is the best option if you need SBOM-first workflows and CycloneDX/SPDX compliance.
- Snyk Container gives the best developer experience with actionable fix suggestions and base image upgrade recommendations.
- Docker Scout is the easiest on-ramp if your team already uses Docker Desktop — zero setup, integrated into
docker build. - Scan at three layers: CI/CD pipeline, container registry admission, and continuous production monitoring.
- The biggest real-world problem isn't finding vulnerabilities — it's triaging the noise. Use severity filters, VEX documents, and distroless base images.
Why Container Security Scanning Matters in 2026
Containers are the default deployment unit for most teams. Kubernetes runs everything from startups to banks. And every container image you deploy is a frozen snapshot of every OS package, language runtime, and application dependency that existed at build time.
The problem: vulnerabilities get disclosed after you build. A clean image today has CVEs tomorrow. And the average container image based on ubuntu:22.04 or node:20 ships with hundreds of packages your application never calls but attackers can exploit.
Container security scanning solves this by automatically checking every layer of your images against vulnerability databases (NVD, GitHub Advisory Database, OS vendor feeds) and flagging what needs attention. The challenge isn't whether to scan — it's choosing the right tool and integrating it without drowning in false positives.
What Container Scanners Actually Check
Modern container scanners inspect multiple layers:
- OS packages — apt, apk, yum packages installed in the base image. This is where most CVEs live.
- Application dependencies — npm, pip, Maven, Go modules, Cargo, Composer packages. Language-specific vulnerability databases.
- Dockerfile misconfigurations — running as root, exposing unnecessary ports, using
latesttags, missing health checks. - Embedded secrets — API keys, passwords, tokens accidentally baked into image layers.
- License compliance — identifying copyleft or restricted licenses in dependencies.
- SBOM generation — producing a Software Bill of Materials for supply chain transparency.
Not every scanner covers all of these. Here's what each tool actually does.
Tool Comparison: The 5 Scanners That Matter
1. Trivy (Aqua Security)
Trivy is the Swiss Army knife of container scanning. Originally a vulnerability scanner, it now covers container images, filesystems, Git repos, Kubernetes clusters, IaC files (Terraform, CloudFormation), and secrets — all in one binary.
What it scans: OS packages, app dependencies (20+ languages), IaC misconfigs, secrets, licenses.
Vulnerability databases: NVD, GitHub Advisory, Red Hat, Debian, Ubuntu, Alpine, Amazon Linux, and more.
Output formats: Table, JSON, SARIF, CycloneDX, SPDX, GitHub dependency snapshot.
CI/CD integration: GitHub Actions, GitLab CI, Jenkins, CircleCI — all have official templates.
Speed: First scan downloads the DB (~30MB). Subsequent scans take 5-15 seconds for typical images.
# Scan a container image
trivy image nginx:1.25
# Scan and fail CI if HIGH or CRITICAL vulns found
trivy image --severity HIGH,CRITICAL --exit-code 1 myapp:latest
# Generate SBOM in CycloneDX format
trivy image --format cyclonedx --output sbom.json myapp:latest
# Scan a Dockerfile for misconfigurations
trivy config Dockerfile
Strengths: Zero config, fast, covers more than just containers, excellent CI/CD templates, active development (weekly releases).
Weaknesses: Vulnerability database can lag 12-24 hours behind NVD for newly published CVEs. No built-in fix suggestions (just tells you what's wrong, not how to fix it).
2. Grype (Anchore)
Grype is Anchore's open-source vulnerability scanner, designed to pair with Syft (their SBOM generator). If your organization needs SBOM-first workflows — generate an SBOM once, scan it repeatedly — Grype is the natural choice.
What it scans: OS packages, app dependencies (15+ languages).
Vulnerability databases: NVD, GitHub Advisory, OS vendor feeds.
Output formats: Table, JSON, CycloneDX, SARIF.
Speed: Comparable to Trivy. DB download is ~50MB.
# Scan an image directly
grype nginx:1.25
# Generate SBOM with Syft, then scan with Grype
syft myapp:latest -o cyclonedx-json > sbom.json
grype sbom:sbom.json
# Fail on high severity
grype myapp:latest --fail-on high
Strengths: Best SBOM integration in the ecosystem. Syft + Grype is the gold standard for supply chain compliance workflows. Clean separation of concerns (SBOM generation vs. vulnerability matching).
Weaknesses: Narrower scope than Trivy — no IaC scanning, no secret detection, no Kubernetes scanning. You need additional tools for those.
3. Snyk Container
Snyk Container is the commercial option that prioritizes developer experience. Its killer feature: it doesn't just tell you a package is vulnerable — it tells you which base image upgrade would fix the most CVEs with the least effort.
What it scans: OS packages, app dependencies, Dockerfile instructions.
Fix suggestions: Recommends specific base image upgrades (e.g., "upgrade from node:18.12 to node:18.19 to fix 23 vulnerabilities").
Pricing: Free tier covers 200 container tests/month. Team plan starts at $25/dev/month.
Integration: Docker Desktop plugin, IDE extensions, CI/CD, container registries.
# Scan an image
snyk container test nginx:1.25
# Monitor an image (continuous scanning)
snyk container monitor myapp:latest
# Scan with Dockerfile context for better fix suggestions
snyk container test myapp:latest --file=Dockerfile
Strengths: Best fix recommendations in the industry. Base image upgrade suggestions save hours of manual research. Good IDE integration for shift-left workflows.
Weaknesses: Free tier is limited. Vulnerability database is proprietary — you can't verify how it differs from NVD. Requires account creation and authentication.
4. Docker Scout
Docker Scout is Docker's native security scanning solution, built into Docker Desktop and the Docker CLI. If your team already uses Docker Desktop, Scout requires zero additional setup.
What it scans: OS packages, app dependencies.
Integration: Built into docker build, Docker Desktop GUI, Docker Hub.
Pricing: Free for Docker Personal (limited scans). Pro/Team/Business plans include more capacity.
# Scan during build
docker scout cves myapp:latest
# Quick overview
docker scout quickview myapp:latest
# Compare two images
docker scout compare myapp:v1 myapp:v2
Strengths: Zero friction for Docker users. Image comparison feature is unique and useful for tracking vulnerability changes between releases.
Weaknesses: Tied to Docker ecosystem. Less flexible than Trivy/Grype for non-Docker container runtimes (Podman, containerd). Scanning depth and database coverage are less transparent than open-source alternatives.
5. AWS ECR Image Scanning
If you're running containers on AWS (ECS, EKS, Fargate), ECR offers two scanning modes: Basic scanning (free, uses Clair) and Enhanced scanning (powered by Amazon Inspector, costs per scan).
Basic scanning: OS package CVEs only. Triggered on push or manual. Free.
Enhanced scanning: OS packages + app dependencies (Java, Python, Node.js, .NET, Go, Ruby). Continuous scanning — re-scans when new CVEs are published. Costs ~$0.09/image/month for continuous.
# Enable enhanced scanning for a repository
aws ecr put-registry-scanning-configuration \
--scan-type ENHANCED \
--rules '[{"repositoryFilters":[{"filter":"*","filterType":"WILDCARD"}],"scanFrequency":"CONTINUOUS_SCAN"}]'
# Get scan findings
aws ecr describe-image-scan-findings \
--repository-name myapp \
--image-id imageTag=latest
Strengths: Native AWS integration. Enhanced scanning with continuous monitoring catches new CVEs against already-deployed images. Findings feed into AWS Security Hub for centralized visibility.
Weaknesses: AWS-only. Basic scanning is too limited for production use. Enhanced scanning costs add up with large image registries.
Head-to-Head Comparison
| Feature | Trivy | Grype | Snyk Container | Docker Scout | ECR Enhanced |
|---|---|---|---|---|---|
| OS package scanning | ✅ | ✅ | ✅ | ✅ | ✅ |
| App dependency scanning | ✅ (20+ langs) | ✅ (15+ langs) | ✅ | ✅ | ✅ (6 langs) |
| IaC scanning | ✅ | ❌ | Separate product | ❌ | ❌ |
| Secret detection | ✅ | ❌ | ❌ | ❌ | ❌ |
| SBOM generation | ✅ | ✅ (via Syft) | ✅ | ✅ | ❌ |
| Fix suggestions | ❌ | ❌ | ✅ (best in class) | ✅ | ❌ |
| Continuous monitoring | ❌ (CI only) | ❌ (CI only) | ✅ | ✅ | ✅ |
| Kubernetes scanning | ✅ | ❌ | Separate product | ❌ | ❌ |
| License compliance | ✅ | ❌ | ✅ | ✅ | ❌ |
| Cost | Free | Free | Free tier / $25+/dev/mo | Free tier / Docker plan | ~$0.09/image/mo |
| CI/CD integration | Excellent | Good | Excellent | Good (Docker-centric) | AWS-only |
Building a Container Scanning Pipeline
The most effective approach layers multiple scan points:
Layer 1: CI/CD Pipeline (Pre-Registry)
Scan every image before it reaches your container registry. This is your first gate.
# GitHub Actions example with Trivy
name: Container Security Scan
on: [push]
jobs:
scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build image
run: docker build -t myapp:${{ github.sha }} .
- name: Trivy vulnerability scan
uses: aquasecurity/trivy-action@master
with:
image-ref: myapp:${{ github.sha }}
severity: HIGH,CRITICAL
exit-code: 1
format: sarif
output: trivy-results.sarif
- name: Upload SARIF
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif
Layer 2: Registry Admission (Post-Push)
Enable scanning at the registry level as a safety net. Images that bypass CI/CD (manual pushes, third-party images) still get scanned.
Layer 3: Continuous Production Monitoring
New CVEs are published daily. An image that was clean last week might have critical vulnerabilities today. Use continuous scanning (Snyk Monitor, ECR Enhanced, or a cron job running Trivy against your registry) to catch these.
Reducing Noise: The Real Challenge
A typical node:20 image has 200+ packages. Scanning it will produce dozens of findings, most of which are in OS packages your application never touches. Here's how to manage the noise:
- Use minimal base images.
node:20-alpinehas ~50 packages vs. ~400 innode:20. Distroless images (Google'sgcr.io/distroless) have even fewer. Fewer packages = fewer CVEs = less triage. - Set severity thresholds. Only fail CI on HIGH and CRITICAL. Track MEDIUM in dashboards but don't block deployments.
- Use VEX documents. The Vulnerability Exploitability eXchange format lets you annotate CVEs as "not affected" when the vulnerable code path is unreachable in your application. Trivy and Grype both support VEX.
- Pin and update base images regularly. Don't use
:latest. Pin to a specific digest, and automate base image updates (Renovate, Dependabot) so you're always on patched versions. - Separate build-time and runtime dependencies. Use multi-stage Docker builds so build tools (compilers, dev dependencies) don't end up in the final image.
Multi-Stage Dockerfile: Security Best Practices
# Build stage — has all the dev tools
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
RUN npm run build
# Runtime stage — minimal attack surface
FROM gcr.io/distroless/nodejs20-debian12
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
USER nonroot
EXPOSE 3000
CMD ["dist/server.js"]
This pattern cuts your vulnerability surface dramatically. The runtime image has no shell, no package manager, no build tools — just the Node.js runtime and your application code.
How SecurityClaw Complements Container Scanning
Container scanners find known vulnerabilities in packages. They don't test whether your application has logic flaws, injection vulnerabilities, or authentication bypasses. SecurityClaw fills this gap by testing the application layer — SQL injection, XSS, SSRF, IDOR, and more — that container scanners can't reach.
The combination matters: a container scanner might tell you your base image is clean, but SecurityClaw will find the SSRF vulnerability that lets an attacker hit the cloud metadata endpoint from inside your "secure" container. Use both.
Which Scanner Should You Choose?
- Small team, just getting started: Trivy. One binary, zero config, covers containers + IaC + secrets. Add it to your CI/CD in 10 minutes.
- Enterprise with SBOM/compliance requirements: Grype + Syft. Generate SBOMs with Syft, scan with Grype, feed into your compliance platform.
- Developer-focused team that wants fix guidance: Snyk Container. The base image upgrade recommendations alone justify the cost for teams that don't have dedicated security engineers.
- All-Docker shop: Docker Scout. Zero friction, built into the tools you already use.
- AWS-native infrastructure: ECR Enhanced Scanning + Trivy in CI/CD. Native integration with Security Hub and Inspector, plus open-source scanning as a first gate.
Most mature teams end up with two layers: an open-source scanner (Trivy or Grype) in CI/CD, plus a registry-native or commercial scanner for continuous monitoring. The tools are cheap or free — the real investment is building the triage workflow so findings actually get fixed.