Grype is a vulnerability scanner for container images and filesystems with an easy to install binary that supports the packages for most major *nix based operating systems.
Features of Grype Vulnerability Scanner For Container Images & Filesystems
Scan the contents of a container image or filesystem to find known vulnerabilities and find vulnerabilities for major operating system packages in:
- Alpine
- BusyBox
- CentOS / Red Hat
- Debian
- Ubuntu
Find vulnerabilities for language-specific packages:
- Ruby (Bundler)
- Java (JARs, etc)
- JavaScript (NPM/Yarn)
- Python (Egg/Wheel)
- Python pip/requirements.txt/setup.py listings
Grype Supports Docker and OCI image formats.
Using Grype Vulnerability Scanner For Container Images & Filesystems
To scan for vulnerabilities in an image:
grype <image>
Grype can scan a variety of sources beyond those found in Docker.
# scan a container image archive (from the result of `docker image save ...`, `podman save ...`, or `skopeo copy` commands)
grype path/to/image.tar
# scan a directory
grype dir:path/to/dir
The output format for Grype is configurable as well:
grype <image> -o <format>
Where the formats available are:
- json: Use this to get as much information out of Grype as possible!
- cyclonedx: An XML report conforming to the CycloneDX 1.2 specification.
- table: A columnar summary (default).
Getting started
Install the binary, and make sure that grype
is available in your path. To scan for vulnerabilities in an image:
grype <image>
The above command scans for vulnerabilities that are visible in the container (i.e., the squashed representation of the image). To include software from all image layers in the vulnerability scan, regardless of its presence in the final image, provide --scope all-layers
:
grype <image> --scope all-layers
Grype can scan a variety of sources beyond those found in Docker.
# scan a container image archive (from the result of `docker image save ...`, `podman save ...`, or `skopeo copy` commands)
grype path/to/image.tar
# scan a directory
grype dir:path/to/dir
Grype’s Database
Grype pulls a database of vulnerabilities derived from the publicly available Anchore Feed Service. This database is updated at the beginning of each scan, but an update can also be triggered manually.
Shell Completion
Grype supplies shell completion through its CLI implementation (cobra). Generate the completion code for your shell by running one of the following commands:
grype completion <bash|fish>
go run main.go completion <bash|fish>
This will output a shell script to STDOUT, which can then be used as a completion script for Grype. Running one of the above commands with the -h
or --help
flags will provide instructions on how to do that for your chosen shell.
You can download Grype or read more here.