-
Notifications
You must be signed in to change notification settings - Fork 7.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: add imagetools examples for inspecting attestations
Signed-off-by: Justin Chadwell <[email protected]>
- Loading branch information
Showing
2 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,6 +168,38 @@ sbom-hugo.spdx.json | |
sbom.spdx.json | ||
``` | ||
|
||
## Inspecting SBOMs | ||
|
||
To explore created SBOMs exported through the `image` exporter, you can use | ||
[`imagetools inspect`](../../engine/reference/commandline/buildx_imagetools_inspect.md). | ||
|
||
Using the `--format` option, you can specify a template for the output. All | ||
SBOM-related data is available under the `.SBOM` attribute. For example, to get | ||
the raw contents of an SBOM in SPDX format: | ||
|
||
```console | ||
$ docker buildx imagetools inspect <namespace>/<image>:<version> \ | ||
--format "{{ json .SBOM.SPDX }}" | ||
{ | ||
"SPDXID": "SPDXRef-DOCUMENT", | ||
... | ||
} | ||
``` | ||
|
||
You can also construct more complex expressions using the full functionality | ||
of go templates. For example, you can list all the installed packages and their | ||
version identifiers: | ||
|
||
```console | ||
$ docker buildx imagetools inspect <namespace>/<image>:<version> \ | ||
--format "{{ range .SBOM.SPDX.packages }}{{ .name }}@{{ .versionInfo }}{{ println }}{{ end }}" | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
[email protected] | ||
... | ||
``` | ||
|
||
## SBOM attestation example | ||
|
||
The following JSON example shows what an SBOM attestation might look like. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters