docs: fix history inspect attachment examples

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2025-06-18 10:54:02 +02:00
parent d09eb752a5
commit ec45eb6ebc
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
1 changed files with 144 additions and 32 deletions

View File

@ -9,12 +9,12 @@ Inspect a build record attachment
### Options ### Options
| Name | Type | Default | Description | | Name | Type | Default | Description |
|:------------------|:---------|:--------|:-----------------------------------------| |:--------------------------|:---------|:--------|:-----------------------------------------|
| `--builder` | `string` | | Override the configured builder instance | | `--builder` | `string` | | Override the configured builder instance |
| `-D`, `--debug` | `bool` | | Enable debug logging | | `-D`, `--debug` | `bool` | | Enable debug logging |
| `--platform` | `string` | | Platform of attachment | | [`--platform`](#platform) | `string` | | Platform of attachment |
| [`--type`](#type) | `string` | | Type of attachment | | [`--type`](#type) | `string` | | Type of attachment |
<!---MARKER_GEN_END--> <!---MARKER_GEN_END-->
@ -27,48 +27,160 @@ platform-specific.
## Examples ## Examples
### <a name="type"></a> Inspect a provenance attachment from a build (--type) ### <a name="platform"></a> Inspect an attachment by platform (--platform)
Supported types include `provenance` and `sbom`.
```console ```console
$ docker buildx history inspect attachment qu2gsuo8ejqrwdfii23xkkckt --type provenance $ docker buildx history inspect attachment --platform linux/amd64
{ {
"_type": "https://slsa.dev/provenance/v0.2", "schemaVersion": 2,
"buildDefinition": { "mediaType": "application/vnd.oci.image.manifest.v1+json",
"buildType": "https://build.docker.com/BuildKit@v1", "config": {
"externalParameters": { "mediaType": "application/vnd.oci.image.config.v1+json",
"target": "app", "digest": "sha256:814e63f06465bc78123775714e4df1ebdda37e6403e0b4f481df74947c047163",
"platforms": ["linux/amd64"] "size": 600
}
}, },
"runDetails": { "layers": [
"builder": "docker", {
"by": "ci@docker.com" "mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
} "digest": "sha256:36537f3920ae948ce3e12b4ae34c21190280e6e7d58eeabde0dff3fdfb43b6b0",
"size": 21664137
}
]
} }
``` ```
### Inspect a SBOM for linux/amd64 ### <a name="type"></a> Inspect an attachment by type (--type)
Supported types include:
* `index`
* `manifest`
* `image`
* `provenance`
* `sbom`
#### Index
```console ```console
$ docker buildx history inspect attachment ^0 \ $ docker buildx history inspect attachment --type index
--type sbom \
--platform linux/amd64
{ {
"bomFormat": "CycloneDX", "schemaVersion": 2,
"specVersion": "1.5", "mediaType": "application/vnd.oci.image.index.v1+json",
"version": 1, "manifests": [
"components": [
{ {
"type": "library", "mediaType": "application/vnd.oci.image.manifest.v1+json",
"name": "alpine", "digest": "sha256:a194e24f47dc6d0e65992c09577b9bc4e7bd0cd5cc4f81e7738918f868aa397b",
"version": "3.18.2" "size": 481,
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"digest": "sha256:49e40223d6a96ea0667a12737fd3dde004cf217eb48cb28c9191288cd44c6ace",
"size": 839,
"annotations": {
"vnd.docker.reference.digest": "sha256:a194e24f47dc6d0e65992c09577b9bc4e7bd0cd5cc4f81e7738918f868aa397b",
"vnd.docker.reference.type": "attestation-manifest"
},
"platform": {
"architecture": "unknown",
"os": "unknown"
}
} }
] ]
} }
``` ```
#### Manifest
```console
$ docker buildx history inspect attachment --type manifest
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"config": {
"mediaType": "application/vnd.oci.image.config.v1+json",
"digest": "sha256:814e63f06465bc78123775714e4df1ebdda37e6403e0b4f481df74947c047163",
"size": 600
},
"layers": [
{
"mediaType": "application/vnd.oci.image.layer.v1.tar+gzip",
"digest": "sha256:36537f3920ae948ce3e12b4ae34c21190280e6e7d58eeabde0dff3fdfb43b6b0",
"size": 21664137
}
]
}
```
#### Provenance
```console
$ docker buildx history inspect attachment --type provenance
{
"builder": {
"id": ""
},
"buildType": "https://mobyproject.org/buildkit@v1",
"materials": [
{
"uri": "pkg:docker/docker/dockerfile@1",
"digest": {
"sha256": "9ba7531bd80fb0a858632727cf7a112fbfd19b17e94c4e84ced81e24ef1a0dbc"
}
},
{
"uri": "pkg:docker/golang@1.19.4-alpine?platform=linux%2Farm64",
"digest": {
"sha256": "a9b24b67dc83b3383d22a14941c2b2b2ca6a103d805cac6820fd1355943beaf1"
}
}
],
"invocation": {
"configSource": {
"entryPoint": "Dockerfile"
},
"parameters": {
"frontend": "gateway.v0",
"args": {
"cmdline": "docker/dockerfile:1",
"source": "docker/dockerfile:1",
"target": "binaries"
},
"locals": [
{
"name": "context"
},
{
"name": "dockerfile"
}
]
},
"environment": {
"platform": "linux/arm64"
}
},
"metadata": {
"buildInvocationID": "c4a87v0sxhliuewig10gnsb6v",
"buildStartedOn": "2022-12-16T08:26:28.651359794Z",
"buildFinishedOn": "2022-12-16T08:26:29.625483253Z",
"reproducible": false,
"completeness": {
"parameters": true,
"environment": true,
"materials": false
},
"https://mobyproject.org/buildkit@v1#metadata": {
"vcs": {
"revision": "a9ba846486420e07d30db1107411ac3697ecab68",
"source": "git@github.com:<org>/<repo>.git"
}
}
}
}
```
### Inspect an attachment by digest ### Inspect an attachment by digest
You can inspect an attachment directly using its digset, which you can get from You can inspect an attachment directly using its digset, which you can get from