Grype + Syft with Docker Images: Make an SBOM and Find Known Holes (Linux, Windows, Mac)
Before you start
- 17 min read
Boxes marked Run in terminal are what you type; plain text explains why. Check what you need first

What you get in one minute#
Syft makes a software bill of materials (SBOM), an inventory of packages in an image; Grype checks that inventory against a database of known vulnerabilities so we can decide what needs fixing before deployment.

Logo: Grype project (official source), CC BY 4.0. Artwork by Anchore, CC BY 4.0; downloaded file unchanged.

Logo: Syft project (official source), CC BY 4.0. Artwork by Anchore, CC BY 4.0; downloaded file unchanged.
We save the inventory once, then scan it again as new vulnerabilities become known. This suits checking an image before adding it to a homelab, keeping evidence of what was deployed, and blocking a build with serious findings. Both tools also work directly on images and directories.
| What | Value (official sources, read 3 December 2026) |
|---|---|
| Grype version | v0.122.1, released 18 November 2026 |
| Syft version | v1.57.2, released 16 November 2026 |
| Licence | Both programs: Apache-2.0; logos: CC BY 4.0 |
| Example image | alpine:3.24.4, tag checked on Docker Hub |
| Time needed | About 30 minutes, our estimate, not measured |
| RAM and disk | No measurements from us; allow room for image layers, the DB and reports |
| Ports | No listening port or web UI in this workflow |
| Official docs | Anchore Open Source |
At a glance:
- Syft: records identified packages, versions and locations.
- Grype: reports known vulnerabilities; it does not patch an image.
- Repeatable evidence: retain the SBOM, image digest, platform, tool versions and DB date.
- Limits: an empty report does not prove that an image is safe or that every package was identified.
We keep the current releases for their fixes, with the specific open reports described below. We have not established that an older pair is generally safer.
How it fits together#
Syft reads the image into a saved inventory; Grype combines that file with vulnerability data, while a direct image scan skips the separate SBOM-saving step.
Our own diagram, drawn from the official scan-target and database documentation.
A tag names an image version. A digest identifies its content; tags can be rebuilt. An SBOM is a snapshot, so rebuilding the image requires a new SBOM. Updating the DB can change the findings for an unchanged snapshot.
Before you start#
Note: every user-supplied domain, email, IP, username, key, token and password shown on this page is a dummy value - replace with your own. Placeholders such as
<your-user>are examples only. Official source and download URLs identify the upstream projects; they are not account settings.
| System | What to have |
|---|---|
| Linux | A supported 64-bit Linux system, shell, curl and tar; these releases include amd64 and arm64 binaries |
| Windows | A supported x64 Windows system with PowerShell and Expand-Archive; this pinned Grype release has a Windows amd64 ZIP |
| Mac | A supported macOS system, Terminal, curl and tar; Intel and Apple Silicon archives are available |
| All three | CPU processing only; no GPU needed. No verified minimum RAM figure. Leave space on both the cache and temporary filesystem |
Docker is optional for the main registry: examples: the tools download image content without starting it. For the local-Docker alternative, check docker --version and that the engine is running; Windows and Mac users can use Docker Desktop with Linux containers.
- [ ] An ordinary user account can write to the workspace below.
- [ ] Existing scan config and reports are backed up before replacement.
- [ ] Internet access is available for installation, registry access and the first DB update.
- [ ] No inbound ports need opening; no domain, DNS record or reverse proxy is required.
Tested on 2026-12-03: Linux = not run; Windows = not run; Mac = not run. We checked documentation, tagged source and issues, but nothing in the installation, scan, CI or restore workflow was run on a real machine. Checks below describe expected results, not captured test output.
Step 1: Install the pinned tools in a workspace#
Everything lives under ~/docker_volumes/grype-syft, including data, config, logs and backups. We install into bin without administrator rights. Keep this terminal open: the PATH change applies only to this session.
Linux#
mkdir -p ~/docker_volumes/grype-syft/{bin,data,config,logs,backups}
cd ~/docker_volumes/grype-syft
curl -fsSL https://raw.githubusercontent.com/anchore/syft/v1.57.2/install.sh -o config/install-syft.sh
curl -fsSL https://raw.githubusercontent.com/anchore/grype/v0.122.1/install.sh -o config/install-grype.sh
less config/install-syft.sh
less config/install-grype.sh
sh config/install-syft.sh -b "$PWD/bin" v1.57.2
sh config/install-grype.sh -b "$PWD/bin" v0.122.1
export PATH="$PWD/bin:$PATH"
syft version
grype version
Read the downloaded installers before running them; press q to leave less. They select the architecture and verify archive checksums. Signature verification is a separate option, described under Security.
Windows (PowerShell)#
We use the release ZIPs directly so package-manager updates cannot change the pin. The loop checks each ZIP against its published SHA-256 before extracting it.
$ErrorActionPreference = 'Stop'
$base = "$HOME\docker_volumes\grype-syft"
foreach ($d in 'bin','data','config','logs','backups') {
New-Item -ItemType Directory -Force "$base\$d" | Out-Null
}
Set-Location $base
$versions = @{ syft = '1.57.2'; grype = '0.122.1' }
foreach ($tool in 'syft','grype') {
$v = $versions[$tool]
$asset = "${tool}_${v}_windows_amd64.zip"
$url = "https://github.com/anchore/$tool/releases/download/v$v"
Invoke-WebRequest "$url/$asset" -OutFile "data/$asset"
Invoke-WebRequest "$url/${tool}_${v}_checksums.txt" -OutFile "data/$tool-checksums.txt"
$line = Get-Content "data/$tool-checksums.txt" | Where-Object { $_.EndsWith($asset) }
if (@($line).Count -ne 1) { throw 'Expected one checksum entry' }
$expected = ($line.Trim() -split '\s+')[0]
$actual = (Get-FileHash "data/$asset" -Algorithm SHA256).Hash
if ($actual -ne $expected) { throw 'Checksum mismatch; stop installation' }
Expand-Archive "data/$asset" -DestinationPath "data/$tool" -Force
Copy-Item "data/$tool/$tool.exe" "bin/$tool.exe" -Force
}
$env:PATH = "$base\bin;$env:PATH"
syft version
grype version
The two throw messages are our script's checks, not Grype error quotations.
Mac (Terminal)#
Same commands as Linux: the installers select darwin_amd64 or darwin_arm64. We use release installers here instead of an unversioned Homebrew install.
Check it worked. The version fields should read 1.57.2 for Syft and 0.122.1 for Grype. Stop if either install fails or another version appears. In a new terminal, return to this folder and repeat the PATH line for your system.
Step 2: Make an SBOM file#
We scan the public sample image as linux/amd64 on every host, including an Apple Silicon Mac. Change the platform to match your deployment when using your own image. The native Syft JSON preserves its detailed inventory; SPDX and CycloneDX are exchange formats for other tools.
Linux#
syft registry:alpine:3.24.4 --platform linux/amd64 \ -o syft-json=data/alpine.syft.json \ -o spdx-json=data/alpine.spdx.json \ -o cyclonedx-json=data/alpine.cdx.json ls -lh data/alpine.*.json
Windows (PowerShell)#
syft registry:alpine:3.24.4 --platform linux/amd64 `
-o syft-json=data/alpine.syft.json `
-o spdx-json=data/alpine.spdx.json `
-o cyclonedx-json=data/alpine.cdx.json
if ($LASTEXITCODE -ne 0) { throw 'SBOM generation failed' }
$sbom = Get-Content data/alpine.syft.json -Raw | ConvertFrom-Json
$sbom.artifacts | Select-Object -First 5 name,version,type
Mac (Terminal)#
Same commands as Linux.
Check it worked. Expect three nonempty JSON files. Open alpine.syft.json: its artifacts array should contain identified packages, and source records the image. We do not promise a package count. Preserve the source digest with the files; use a digest reference for production comparisons.
Tip: Use Syft's
-o format=pathfile writer. It avoids shell encoding differences on Windows. A default human-readable table is not an SBOM you can feed back to Grype.
Step 3: Scan the SBOM and the image#
First keep the database in our workspace. We explicitly pass this config, so unrelated config in a home directory does not silently change the example.
Linux#
cat > .grype.yaml << 'EOF' db: cache-dir: ./data/db EOF grype -c .grype.yaml db update grype -c .grype.yaml db status grype -c .grype.yaml sbom:./data/alpine.syft.json grype -c .grype.yaml sbom:./data/alpine.syft.json -o json --file logs/alpine.grype.json grype -c .grype.yaml registry:alpine:3.24.4 --platform linux/amd64
Windows (PowerShell)#
@'
db:
cache-dir: ./data/db
'@ | Set-Content -Encoding ascii .grype.yaml
grype -c .grype.yaml db update
if ($LASTEXITCODE -ne 0) { throw 'Database update failed' }
grype -c .grype.yaml db status
grype -c .grype.yaml sbom:./data/alpine.syft.json
grype -c .grype.yaml sbom:./data/alpine.syft.json -o json --file logs/alpine.grype.json
grype -c .grype.yaml registry:alpine:3.24.4 --platform linux/amd64
Mac (Terminal)#
Same commands as Linux.
Check it worked. DB status should be valid and show its build date and schema. The scan should finish with a findings table or a no-findings result. Read package name, installed version, fixed version when available, vulnerability identifier and severity. An error or empty report file is not a successful scan.
The direct command inventories the image itself. It may differ from the saved-SBOM result if the tag moved, the DB changed, or the tools identified packages differently. A directory target such as syft dir:./project -o syft-json=data/project.syft.json inventories an existing project folder, not the eventual container image.
Tip: An SBOM scan does not inspect running-container changes or mounted data volumes. For deployment decisions, scan the actual built image, then investigate individual findings before rebuilding or replacing it.
Step 4: Prepare an offline database#
Normal online scans check for DB updates. By default, Grype rejects a DB built more than 120 hours (five days) ago. Offline use needs a recent DB archive, the saved SBOM and the scanner binary; an SBOM alone is insufficient.
On an online machine, run grype -c .grype.yaml db list. It prints DB URL and Checksum. Download that exact archive using a browser, save it as data/grype-db.tar.zst, and retain the listing. Compare its SHA-256 with the listing's sha256: value: sha256sum data/grype-db.tar.zst on Linux, Get-FileHash data/grype-db.tar.zst -Algorithm SHA256 on Windows, or shasum -a 256 data/grype-db.tar.zst on Mac. Stop on a mismatch.
Transfer the archive, SBOM and appropriate binary to the offline machine's same workspace layout. Create config/offline.grype.yaml with this content on each system:
check-for-app-update: false external-sources: enable: false db: cache-dir: ./data/db auto-update: false validate-age: true max-allowed-built-age: 120h
Linux#
grype -c config/offline.grype.yaml db import ./data/grype-db.tar.zst grype -c config/offline.grype.yaml db status grype -c config/offline.grype.yaml sbom:./data/alpine.syft.json
Windows (PowerShell)#
grype -c config/offline.grype.yaml db import ./data/grype-db.tar.zst
if ($LASTEXITCODE -ne 0) { throw 'Database import failed' }
grype -c config/offline.grype.yaml db status
grype -c config/offline.grype.yaml sbom:./data/alpine.syft.json
Mac (Terminal)#
Same commands as Linux.
Check it worked. Status should report a valid DB with the expected build date, and the SBOM scan should complete without needing the image registry. This is the documented workflow, not a network-isolation test by us. Refresh the transferred archive before it expires; disabling age validation does not refresh intelligence.
Schema-v5 DB publication ended on 6 March 2026. Grype v0.88.0 and newer use v6. Do not revive an old CI pin to work around an import problem. Use db import on the archive: unpacking files and inventing import.json is not equivalent.
Put it behind HTTPS with Traefik? No web service here#
These are CLI commands that exit after their work. There is no browser interface, published port, Compose service or restart policy to configure.
With Traefik#
No labels or router are needed.
Without Traefik: Caddy#
No reverse_proxy entry is needed. Keep your registry's own HTTPS working; our Harbor and Docker Registry guides cover registry hosting separately.
Security and testing#
Run scans as an ordinary user. The registry: route requires no Docker socket access. For private images, the official tools can use Docker's credential config and helpers; prefer a helper and a token limited to pulling images. Keep real credentials out of reports and Git. If you store a secret in .env, restrict it with chmod 600 .env on Linux/Mac or user-only file permissions on Windows; native Grype and Syft do not automatically load that file.
Checksums detect a changed download; they do not independently prove who published it. With Cosign installed, the shell installers support -v for signature verification. Both pins here publish checksums.txt.sigstore.json bundles; Grype's tagged installer is newer than the documentation that still describes its older separate signature files. Follow the verification guide using the assets belonging to the chosen release.
SBOMs and debug logs can reveal private package names, paths and registry references. Keep them private and redact them before sharing. Check the exit status immediately after each command: echo $? on Linux/Mac, $LASTEXITCODE on PowerShell. A successful command is not proof of complete package coverage.
Record a narrow exception with a reason#
Add this example to .grype.yaml, keeping its existing db section. These are deliberately nonmatching dummy identifiers; replace them only after investigating a real finding.
ignore:
- vulnerability: "<vulnerability-id>"
package:
name: "<package-name>"
version: "<installed-version>"
reason: "Dummy: vendor backport verified in <advisory-url>; reassess on <review-date>."
All selectors in one rule must match. The reason records your evidence; a review date in text is not an automatic expiry. Inspect exceptions with grype -c .grype.yaml sbom:./data/alpine.syft.json --show-suppressed. JSON reports retain suppressed findings under ignoredMatches.
Tip: An ignore rule affects the CI threshold too. Avoid ignoring a whole package merely to turn a build green. Keep an unfiltered report, document the evidence, and remove the exception when the image changes.
For shared product assessments, Grype also accepts OpenVEX and CSAF VEX documents. VEX describes whether a particular product is affected; it needs evidence and matching product identifiers. It is not a substitute for investigating a vulnerability.
Fail a Forgejo Actions job on high findings#
Save this in .forgejo/workflows/vulnerability.yaml in a Forgejo repository. The runner label docker is an example: select your configured Linux runner with curl, sh and tar. No checkout is needed for this public-image demonstration.
name: vulnerability-scan
on: [push]
jobs:
scan:
runs-on: docker
timeout-minutes: 10
steps:
- name: Save inventory and enforce severity threshold
run: |
set -eu
mkdir -p tools reports
curl -fsSL https://raw.githubusercontent.com/anchore/syft/v1.57.2/install.sh -o tools/install-syft.sh
curl -fsSL https://raw.githubusercontent.com/anchore/grype/v0.122.1/install.sh -o tools/install-grype.sh
sh tools/install-syft.sh -b "$PWD/tools" v1.57.2
sh tools/install-grype.sh -b "$PWD/tools" v0.122.1
tools/syft registry:alpine:3.24.4 --platform linux/amd64 -o syft-json=reports/image.syft.json
tools/grype sbom:reports/image.syft.json --fail-on high -o json --file reports/grype.json
--fail-on high returns 2 when remaining findings include high or critical severity. It controls failure, not just display. Other nonzero failures must also stop deployment. Do not add || true or continue-on-error to a blocking scan.
For your pipeline, scan the digest produced by its build, retain both reports using your artifact mechanism, and require this job before deployment. The example does not upload artifacts or deploy anything. If you add a checked-in exception file, check out the repository and pass it with -c. Adding --only-fixed changes policy by suppressing findings without an available fix.
Grype vs Trivy#
Trivy combines vulnerability scanning with other checks, including secrets and configurable misconfiguration scanning. Syft plus Grype makes the inventory-and-rescan workflow explicit. Both approaches can be useful; we have not run an accuracy or speed comparison.
Compare the same digest, architecture, DB dates and suppression policy. Different package identification and advisory matching can produce different findings. Investigate the package location and vendor advisory rather than declaring whichever tool reports more rows the winner. Trivy's own image documentation explains which checks are enabled by default.
Common mistakes#
These exact error fragments come from real GitHub issues we read for this guide. Historical reports explain symptoms, not a claim that every bug persists in our pins. The AI row is advice we should reject from an assistant; the original reporter did not attribute it to AI.
| Mistake | Why it happens | Do this instead |
|---|---|---|
Copying an old complete config: failed to load vulnerability db: database does not exist (2505) | A legacy DB URL survived a schema upgrade; the reporter confirmed that cause | Remove the obsolete db.update-url override and let current defaults apply; update the DB |
Downgrading permanently after invalid cross-device link (2517) | Early v6 releases moved DB files across a volume boundary | Use a current client and inspect cache placement; do not return to unsupported v5 data |
AI assistants: proposing hand-written import metadata: import metadata digest is not in the expected format (3388) | Extracted files are mistaken for a completed import | Run grype db import on the downloaded archive; let Grype create its metadata |
Checking only the main disk after no space left on device (572) | Temporary storage was full even with a different cache location | Check the actual temporary and cache filesystems; the historical reporter confirmed that changing TMPDIR helped |
Retrying without a limit: unable to download listing: bad response code: 504 (2910) | A DB request stalled before the final missing-DB error | Bound CI runtime, retain debug logs and inspect the earlier network failure |
Disabling certificate checks after net/http: TLS handshake timeout (3937) | A current-release report involves a network inspection device and TLS compatibility | Keep certificate verification; fetch through a working path and scan a local image archive |
Troubleshooting#
| Problem | Solution |
|---|---|
| Need versions and DB evidence | syft version, grype version, grype -c .grype.yaml db status |
| Unexpected settings | grype -c .grype.yaml config; inspect relevant environment overrides too; redact output before sharing |
| Need debug detail | grype -c .grype.yaml -vv sbom:./data/alpine.syft.json 2> logs/grype-debug.log |
| Offline scan refuses an old DB | Transfer a fresh archive and repeat Step 4; inspect its build date |
| A local Docker scan fails | Check docker info; use registry: for a published image or docker-archive: for an exported image |
failed to load vulnerability db: database does not exist#
Issue 2505 was resolved by correcting stale configuration. Check the client version, configured DB location and update URL before blaming the SBOM format. Run grype -c .grype.yaml db update online; import a compatible archive offline.
import metadata digest is not in the expected format#
In issue 3388, maintainers explained that copying DB files bypassed import processing. Import the original .tar.zst archive. That issue closed after inactivity, so we do not claim the reporter confirmed a final fix.
Known bugs (open, December 2026)#
Grype 3937 reports a TLS timeout with v0.122.1 on a particular inspected network path. The reporter successfully scanned a separately downloaded archive with grype docker-archive:./image.tar. With Docker available, docker image save -o data/image.tar alpine:3.24.4 exports an already-pulled image; scan that path instead. We did not reproduce the workaround.
Syft 5651 reports inconsistent Yarn Berry inventories in v1.57.2. The reporter's workaround is SYFT_JAVASCRIPT_INCLUDE_DEV_DEPENDENCIES=true, which includes development packages too. Cross-check that inventory before treating it as production-only; we have not validated the workaround.
Updates and backups#
Review both release notes, update the exact pins in Step 1 and CI, then generate a fresh SBOM and compare it with the previous inventory. A binary update and grype db update are separate operations. Keep the previous reports so a changed result can be investigated.
Back up .grype.yaml, config, SBOMs and reports. The following scripts include data, so they also retain the DB and downloaded archives. Copy backups off the machine; a local archive alone does not protect against disk failure.
Linux and Mac#
Save as backup.sh in the workspace:
#!/usr/bin/env bash set -eu base="$HOME/docker_volumes/grype-syft" tar -czf "$base/backups/scan-$(date +%F).tar.gz" -C "$base" .grype.yaml config data logs chmod 600 "$base/backups/scan-$(date +%F).tar.gz"
Use chmod 700 backup.sh. Add 0 3 * * * /bin/bash "$HOME/docker_volumes/grype-syft/backup.sh" with crontab -e for 03:00 daily, while the machine is awake. Avoid overlapping backups with DB updates or report writes.
Windows (PowerShell)#
Save as backup.ps1:
$base = "$HOME\docker_volumes\grype-syft"
$out = "$base\backups\scan-$(Get-Date -Format yyyy-MM-dd).tar.gz"
tar.exe -czf $out -C $base .grype.yaml config data logs
if ($LASTEXITCODE -ne 0) { throw 'Backup failed' }
In Task Scheduler, run powershell.exe daily at 03:00, with arguments -NoProfile -File "<full-path-to-backup.ps1>" under your own account. That path is a dummy placeholder. Verify the task result and restrict archive access to your account.
Restore test#
Create an empty scratch folder, then extract one chosen archive there with tar -xzf "<archive-path>" -C "<scratch-folder>" (Windows: tar.exe). Both quoted paths are dummy placeholders. Change into the scratch folder and run grype -c .grype.yaml db status, then grype -c .grype.yaml sbom:./data/alpine.syft.json.
Compare the restored SBOM's checksum with the original. Refresh an expired DB before rescanning, and expect findings to change with fresh intelligence. Confirm that exception reasons survived. This is a proposed restore test, not one we performed.
Performance and resources#
We measured no RAM, CPU, disk footprint or scan duration. The first scan includes image and DB downloads; later SBOM scans avoid retrieving the original layers. Large files and archive inspection can change resource use substantially.
Keep a persistent DB cache and measure one representative image before scheduling many scans. Use Activity Monitor on Mac, Task Manager on Windows, or top and df -h on Linux. Grype documents search.unindexed-archives as a potentially expensive option because it decompresses archives; leave it at its default unless the extra coverage is needed.
FAQ#
Do we need both tools? No. Grype scans images directly. Syft is useful when we want to retain, share or rescan the inventory separately.
Does a clean report mean safe to deploy? No. It means no unsuppressed known matches were found in the identified inventory with that DB and configuration. It is not a penetration test.
Will Grype fix the image? No. Update dependencies or the base image, rebuild, generate a new SBOM and rescan. Diun can notify us about image updates, but serves a different purpose.
Can we scan without Docker? Yes. The registry:, directory and saved-SBOM paths do not require a running Docker daemon. Private registries still require appropriate authentication.
Which SBOM should we keep? Keep native Syft JSON for this workflow, plus an exchange format if another consumer needs it. Preserve the image identity and tool versions alongside it.
Sources#
- Grype v0.122.1 release and Apache-2.0 licence; Syft v1.57.2 release and Apache-2.0 licence — November 2026 releases, checked December 2026.
- Tagged installers: Grype, Syft; download verification — checked December 2026; tagged assets take precedence over the older Grype signature wording.
- Syft CLI, output formats, Grype CLI, configuration, filtering and VEX, private registries — checked December 2026, with used options cross-checked against tagged source.
- DB operations, v5 retirement, v0.122.1 ignore-rule fields, v0.122.1 import command — checked December 2026.
- Alpine 3.24.4 tag metadata, Forgejo workflow quick start, Forgejo workflow reference, Trivy image scanning — checked December 2026.
- GitHub issue bodies and comments linked under Common mistakes and Troubleshooting were opened directly through the GitHub API — December 2026. They are user reports, not our test evidence.
Checked against the official docs on 2026-12-03.