This tutorial illustrates how to create an sbom from a container image using the Syft CLI.
A container software e.g.:
-
Docker
-
Podman
- Curl
-
Chocolatey
-
Scoop
- Homebrew
Run the following command:
curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin
brew install syft
choco install syft -y
or
scoop install syft
To generate an SBOM, run the command:
syft <image>
Where image is:
-
A remote image from a repository.
-
A local image dictionary.
-
A local compressed image dictionary.
An SBOM will be printed to your terminal.
To create an SBOM in a standardized SBOM format, use the -o
flag:
syft <image> -o <format>
Where <format>
is one of:
cyclonedx-json
cyclonedx-xml
spdx-json
spdx-tag-value
syft-json
syft-table
syft-text
github-json
To output the SBOM to a file, run the above command but add =<output_file>
to the -o
format:
syft <image> -o <format>=<output_file_name>
An SBOM file of your specified name and format will be created.
In Linux, sudo may be required.
<title>Pretty JSON Display</title> <style> #json-container { height: 400px; /* Set a fixed height */ overflow-y: auto; /* Enable vertical scrolling */ border: 2px solid #ccc; /* Optional: add a border for visibility */ padding: 10px; } #xml-container { height: 400px; /* Set a fixed height */ overflow-y: auto; /* Enable vertical scrolling */ border: 2px solid #ccc; /* Optional: add a border for visibility */ padding: 10px; } pre { margin: 0; white-space: pre-wrap; word-wrap: break-word; } </style>- Anchore. (n.d.). Anchore/syft: CLI Tool and library for generating a software bill of materials from container images and filesystems. GitHub. https://github.com/anchore/syft