SBOMgensbomgen

Creating SBOMs From Images Using Syft

Introduction

This tutorial illustrates how to create an sbom from a container image using the Syft CLI.

Requirements

All

A container software e.g.:

Linux

Windows

MacOS

Installation

Run the following command:

Linux

curl -sSfL https://raw.githubusercontent.com/anchore/syft/main/install.sh | sh -s -- -b /usr/local/bin

MacOS

brew install syft

Windows

choco install syft -y

or

scoop install syft

Usage

To generate an SBOM, run the command:

syft <image>

Where image is:

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:

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.

Notes

In Linux, sudo may be required.

Example SBOM

This section illustrates CycloneDX and SPDX JSON SBOMs of an Nginx image, produced via Syft.

Pretty JSON Display

nginx image cdx (json)


    

nginx image spdx (json)


    

References