Join our Discord Server
Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).

How to Generate Your SBOM from Docker Images

2 min read

In today’s software landscape, understanding the components of your applications is crucial for security and compliance. A Software Bill of Materials (SBOM) provides a comprehensive list of all components in your software, including open-source and third-party elements. Docker Scout offers a powerful tool to generate SBOMs for your Docker images, enhancing your ability to manage and secure your software supply chain.

What is an SBOM?

An SBOM is essentially a list of ingredients for your software. It typically includes:

  • The name of the software component
  • Its version
  • The license under which it’s distributed
  • A list of dependencies

How Docker Scout uses SBOMs

Docker Scout uses SBOMs to determine the components that are used in a Docker image. When you analyze an image, Docker Scout will either use the SBOM that is attached to the image (using attestations), or it will generate an SBOM on the fly by analyzing the contents of the image.

The SBOM is cross-referenced with the advisory database to determine if any of the components in the image have known vulnerabilities.

Why Generate an SBOM?

SBOMs are crucial for:

  • Identifying and mitigating security risks
  • Ensuring compliance with licensing requirements
  • Quickly responding to newly discovered vulnerabilities
  • Generating SBOMs with Docker Scout

Docker Scout provides a straightforward way to generate SBOMs for your Docker images. Here’s how you can do it:

1. Basic SBOM Generation

To generate a basic SBOM in JSON format, use the following command:

docker scout sbom [IMAGE]

This command will analyze the image and output the SBOM to your console Docker Scout SBOMs.

2. SPDX Format Output

If you need the SBOM in SPDX format, which is a widely used standard, use:

docker scout sbom --format spdx [IMAGE]

3. Human-Readable List

For a more readable output, you can generate a list of packages:

docker scout sbom --format list [IMAGE]

This is particularly useful for quick inspections Docker Scout SBOMs.

4. Saving SBOM to a File

To save the SBOM for later use or sharing, use:

docker scout sbom --output [FILENAME] [IMAGE]


This command saves the SBOM to the specified file docker scout sbom.

5. Generating SBOM During Build

For a more integrated approach, you can generate the SBOM during the image build process:

docker build --tag <org>/<image> \
  --attest type=sbom,generator=docker/scout-sbom-indexer:latest \
  --push .

This method attaches the SBOM to the image as an attestation, making it an integral part of your image metadata Docker Scout SBOMs.

Working with Different Image Types

Docker Scout is versatile and can work with various image types:

  • For local images, use the local:// prefix
  • For registry images, use registry://
  • For image tarballs (created by docker save), use archive://

This flexibility ensures you can generate SBOMs for images in different states and locations, such as docker scout sbom.

Conclusion

Generating SBOMs for your Docker images is a crucial step in maintaining a secure and compliant software supply chain. With Docker Scout, this process becomes straightforward and integrated into your existing Docker workflows. By regularly generating and reviewing SBOMs, you can stay ahead of potential security issues and ensure that your software components are always accounted for.

Remember, an SBOM is not just a static document but a living inventory of your software components. Make it a habit to update and review your SBOMs as part of your continuous integration and deployment processes.

Have Queries? Join https://launchpass.com/collabnix

Ajeet Raina Ajeet Singh Raina is a former Docker Captain, Community Leader and Distinguished Arm Ambassador. He is a founder of Collabnix blogging site and has authored more than 700+ blogs on Docker, Kubernetes and Cloud-Native Technology. He runs a community Slack of 9800+ members and discord server close to 2600+ members. You can follow him on Twitter(@ajeetsraina).
Join our Discord Server
Index