Grype is a command-line tool that scans your Docker images and finds known security vulnerabilities. That's it. No enterprise sales pitch, no "paradigm-shifting solutions" - it just tells you what's broken in your containers so you can fix it before someone exploits it.
Been running this for a while now in production, and here's what actually matters.
The Problem: Your Images Are Full of Holes
Look, every Docker image you pull has vulnerabilities. Pull ubuntu:20.04
right now and scan it - you'll find dozens of CVEs. Pull node:16-alpine
and you'll find more. That fancy base image your team loves? Also compromised.
The issue isn't that vulnerabilities exist (they always will), it's that most teams have no idea what's in their images. You layer on packages, add dependencies, copy in binaries, and ship to production without knowing you're running OpenSSL 1.1.1k with CVE-2021-3712.
Learned this the hard way during a security audit where they found hundreds of "critical" vulnerabilities in our prod images. Most of them were in random OS packages we never touch, but try explaining that to an auditor who just wants everything fixed. Spent that whole weekend dealing with the mess. NIST's guidance on container security makes it clear that visibility into your software supply chain is critical.
How Grype Actually Works
Grype downloads a vulnerability database (about 150MB) that gets updated daily with CVE feeds from multiple sources including NVD, Alpine SecDB, and Ubuntu Security Notices. When you scan an image, it:
It rips apart your image layer by layer, checks every package against its vulnerability database, then spits out everything that's broken and how badly you're screwed.
The scan takes about 5-15 seconds for typical images. Faster than Clair (when Clair isn't completely fucked), more accurate than most commercial tools, and way less painful than explaining to your CISO why you shipped prod with a 2019 version of curl.
SBOMs That Don't Completely Suck
Grype pairs with Syft to generate Software Bills of Materials. Before you roll your eyes - this is actually practical.
Generate an SBOM once during your build: syft packages my-app:latest -o json > sbom.json
Then scan the SBOM instead of the image: grype sbom:sbom.json
This cuts scan time from 10 seconds to 2 seconds, which matters when you're scanning 50+ images in CI. Plus you get inventory tracking for free, which makes compliance people happy. The executive order on cybersecurity specifically calls out SBOMs as critical for supply chain security.
Real Performance Numbers
Scan times vary like hell depending on your setup:
- Alpine apps: pretty fast - few seconds on my laptop, longer on our shitty CI runners
- Ubuntu-based stuff: takes longer - maybe 8-15 seconds depending on how much crap you've installed
- Java fat JARs: can take forever when Spring Boot includes the entire internet as dependencies
- Full OS images: 15+ seconds usually, longer when your network decides to be garbage
Memory usage stays under 100MB, so it doesn't kill your CI runners like some other tools do. Check out Anchore's benchmarks against other scanners.
The Gotchas You'll Hit
Database updates can break CI: Grype downloads the vuln database on first run. If your CI doesn't cache this properly, you'll hit rate limits or timeouts. I've watched entire teams get blocked for hours because someone changed the CDN endpoint and our corporate proxy wasn't updated. Set up a cron job to pre-pull the database or use the offline mode.
False positives in distroless images: Had an older version that was totally broken with distroless base images - reported vulnerabilities for packages that weren't even installed. Spent a day chasing phantom CVEs before realizing it was a Grype bug. Fixed in newer versions, but pin your Grype version in CI or you'll get burned by shit like this.
Windows paths will fuck you: On Windows, the database cache path gets mangled and Grype randomly fails with "cannot write to cache directory". Use GRYPE_DB_CACHE_DIR=C: emp\grype
explicitly or it'll try to write to some deep nested AppData folder that doesn't exist.
Alpine packages get weird: Alpine uses different package names than Debian/Ubuntu. Sometimes Grype misses vulnerabilities in Alpine packages because the CVE database uses the Debian naming. Not Grype's fault, but worth knowing. Some versions are more aggressive about package matching which leads to more false positives. The Alpine security team maintains their own security database, but it's often weeks behind CVE publications.
Java apps timeout randomly: Large Spring Boot JARs (anything over 200MB) can cause Grype to hang on certain versions. The JAR scanning can be slow as hell. Use --timeout 10m
or scan the SBOM instead of raw images if you're hitting timeouts.
The tool works, it's fast, and it doesn't require a PhD to configure. That's more than I can say for most security tools. If you want deeper integration, check out Anchore Enterprise for policy enforcement and Kubernetes admission controllers.