Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Trivy is a comprehensive open-source vulnerability scanner by Aqua Security that detects vulnerabilities in OS packages, language-specific dependencies, misconfigurations, secrets, and license violati
.claude/skills/scanning-docker-images-with-trivy/SKILL.md| Model | Eval pass | Runs |
|---|---|---|
| gemini-3.6-flash | 96% | 31 |
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-09 | ✗→✓ | ▲ Improved | — | — |
| case-04 | ✓→✓ | = Same ✓ | — | — |
| case-08 | ✓→✓ | = Same ✓ | — | — |
| case-19 | ✗→✗ | = Same ✗ | — | — |
| case-07 | ✗→✗ | = Same ✗ | — | — |
Trivy is a comprehensive open-source vulnerability scanner by Aqua Security that detects vulnerabilities in OS packages, language-specific dependencies, misconfigurations, secrets, and license violations within container images. It integrates into CI/CD pipelines and supports multiple output formats including SARIF, CycloneDX, and SPDX.
| Scanner | Flag | Detects | |---------|------|---------| | Vulnerability | --scanners vuln | CVEs in OS packages and libraries | | Misconfiguration | --scanners misconfig | Dockerfile/K8s manifest misconfigs | | Secret | --scanners secret | Hardcoded passwords, API keys, tokens | | License | --scanners license | Software license compliance issues |
Trivy uses multiple vulnerability databases:
bash# Linux (apt) sudo apt-get install wget apt-transport-https gnupg lsb-release wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list sudo apt-get update && sudo apt-get install trivy # macOS brew install trivy # Docker docker pull aquasecurity/trivy:latest
bash# Scan a public image trivy image python:3.12-slim # Scan with severity filter trivy image --severity CRITICAL,HIGH nginx:latest # Ignore unfixed vulnerabilities trivy image --ignore-unfixed alpine:3.19 # Scan local image docker build -t myapp:latest . trivy image myapp:latest # Scan from tar archive docker save myapp:latest -o myapp.tar trivy image --input myapp.tar
bash# All scanners (vuln + misconfig + secret + license) trivy image --scanners vuln,misconfig,secret,license myapp:latest # Generate SBOM in CycloneDX format trivy image --format cyclonedx --output sbom.cdx.json myapp:latest # Generate SBOM in SPDX format trivy image --format spdx-json --output sbom.spdx.json myapp:latest # JSON output for programmatic processing trivy image --format json --output results.json myapp:latest # SARIF output for GitHub Security tab trivy image --format sarif --output results.sarif myapp:latest # Template-based output trivy image --format template --template "@contrib/html.tpl" --output report.html myapp:latest # Scan specific layers only trivy image --list-all-pkgs myapp:latest
bash# Scan Dockerfile for misconfigurations trivy config Dockerfile # Scan Kubernetes manifests trivy config k8s-deployment.yaml # Scan Helm charts trivy config ./helm-chart/ # Scan Terraform files trivy config ./terraform/
yaml# GitHub Actions name: Trivy Container 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: Run Trivy vulnerability scanner uses: aquasecurity/trivy-action@master with: image-ref: myapp:${{ github.sha }} format: sarif output: trivy-results.sarif severity: CRITICAL,HIGH exit-code: 1 - name: Upload Trivy scan results uses: github/codeql-action/upload-sarif@v3 if: always() with: sarif_file: trivy-results.sarif - name: Generate SBOM uses: aquasecurity/trivy-action@master with: image-ref: myapp:${{ github.sha }} format: cyclonedx output: sbom.cdx.json
yaml# GitLab CI trivy-scan: stage: security image: name: aquasecurity/trivy:latest entrypoint: [""] script: - trivy image --exit-code 1 --severity CRITICAL,HIGH --format json --output gl-container-scanning-report.json $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA artifacts: reports: container_scanning: gl-container-scanning-report.json
bash# .trivyignore - Ignore specific CVEs with expiry # Accepted risk: low-impact vulnerability in dev dependency CVE-2023-12345 exp:2025-06-01 # False positive: not exploitable in our configuration CVE-2024-67890 # Vendor will not fix CVE-2023-11111
bash# Docker Hub (uses ~/.docker/config.json) trivy image myregistry.azurecr.io/myapp:latest # ECR aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin <account>.dkr.ecr.us-east-1.amazonaws.com trivy image <account>.dkr.ecr.us-east-1.amazonaws.com/myapp:latest # GCR trivy image gcr.io/my-project/myapp:latest # With explicit credentials TRIVY_USERNAME=user TRIVY_PASSWORD=pass trivy image registry.example.com/myapp:latest
bash# Verify Trivy installation trivy version # Update vulnerability database trivy image --download-db-only # Quick scan with table output trivy image --severity CRITICAL python:3.12 # Verify no CRITICAL vulnerabilities trivy image --exit-code 1 --severity CRITICAL myapp:latest echo "Exit code: $?" # 0 = no vulns, 1 = vulns found
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-19 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-07 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-23 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-10 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-18 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-01 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-06 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-03 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-17 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-16 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-21 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-22 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-11 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-05 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-15 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-12 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-09 | fail→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-20 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-02 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-04 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-08 | pass→pass | — | — | — | — | — | — | — | — | — | — | — | — |
case-13 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
case-14 | fail→fail | — | — | — | — | — | — | — | — | — | — | — | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 23 cases were attempted. The headline lift of +4 percentage points is the difference between those two pass rates over the 23 comparable cases.
The per-case answers from this run were removed by the retention sweep, so the case table below shows the verdicts without the text either arm produced. The counts above were recorded at the time and are unaffected. Answers are now kept for 180 days.
Other measured skills in the registry, with their headline benchmark lift.