Skip to content

Commit f51a8f5

Browse files
feedback + updated examples + added links for h3 headings
1 parent d4a2af5 commit f51a8f5

10 files changed

+299
-57
lines changed

docs/reference/buildx_history.md

+29
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,32 @@ Commands to work on build records
2727

2828
<!---MARKER_GEN_END-->
2929

30+
### Build references
31+
32+
Most `buildx history` subcommands accept a build reference to identify which
33+
build to act on. You can specify the build in two ways:
34+
35+
- By build ID, fetched by `docker buildx history ls`:
36+
37+
```console
38+
docker buildx history export qu2gsuo8ejqrwdfii23xkkckt --output build.dockerbuild
39+
```
40+
41+
- By relative offset, to refer to recent builds:
42+
43+
```console
44+
docker buildx history export ^1 --output build.dockerbuild
45+
```
46+
47+
- `^0` or no reference targets the most recent build
48+
- `^1` refers to the build before the most recent
49+
- `^2` refers to two builds back, and so on
50+
51+
Offset references are supported in the following `buildx history` commands:
52+
53+
- `logs`
54+
- `inspect`
55+
- `open`
56+
- `trace`
57+
- `export`
58+
- `rm`

docs/reference/buildx_history_export.md

+34-8
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,49 @@ Desktop or shared across environments.
2323

2424
## Examples
2525

26-
### Export a single build to a custom file
26+
### <a name="export-single-build"></a> Export a single build to a custom file
2727

2828
```console
29-
docker buildx history export mybuild --output mybuild.dockerbuild
29+
docker buildx history export qu2gsuo8ejqrwdfii23xkkckt --output mybuild.dockerbuild
3030
```
3131

32-
### Export multiple builds to individual `.dockerbuild` files
32+
You can find build IDs by running:
3333

34-
This example writes `mybuild.dockerbuild` and `backend-build.dockerbuild` to
35-
the current directory:
34+
```console
35+
docker buildx history ls
36+
```
37+
38+
### <a name="export-multiple-builds"></a> Export multiple builds to individual `.dockerbuild` files
39+
40+
To export two builds to separate files:
41+
42+
```console
43+
# Using build IDs
44+
docker buildx history export qu2gsuo8ejqrwdfii23xkkckt -o mybuild.dockerbuild
45+
docker buildx history export qsiifiuf1ad9pa9qvppc0z1l3 -o backend-build.dockerbuild
46+
47+
# Or using relative offsets
48+
docker buildx history export ^1 -o mybuild.dockerbuild
49+
docker buildx history export ^2 -o backend-build.dockerbuild
50+
```
51+
52+
Or use shell redirection:
53+
54+
```console
55+
docker buildx history export ^1 > mybuild.dockerbuild
56+
docker buildx history export ^2 > backend-build.dockerbuild
57+
```
58+
59+
### <a name="export-all-builds"></a> Export all build records to a file
60+
61+
Use the `--all` flag and redirect the output:
3662

3763
```console
38-
docker buildx history export mybuild backend-build
64+
docker buildx history export --all > all-builds.dockerbuild
3965
```
4066

41-
### Export all build records
67+
Or use the `--output` flag:
4268

4369
```console
44-
docker buildx history export --all
70+
docker buildx history export --all -o all-builds.dockerbuild
4571
```

docs/reference/buildx_history_import.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,26 @@ pipelines.
2222

2323
## Examples
2424

25-
### Import a `.dockerbuild` archive into Docker Desktop
25+
### <a name="import-dockerbuild"></a> Import a `.dockerbuild` archive from standard input
2626

2727
```console
2828
docker buildx history import < mybuild.dockerbuild
2929
```
3030

31-
### Import a file using a specific path
31+
### <a name="import-build-archive"></a> Import a build archive from a file
3232

3333
```console
3434
docker buildx history import --file ./artifacts/backend-build.dockerbuild
3535
```
3636

37-
### Import a file and open it in Docker Desktop
37+
### <a name="open-build-manually"></a> Open a build manually
38+
39+
By default, the `import` command automatically opens the imported build in Docker
40+
Desktop. You don't need to run `open` unless you're opening a specific build
41+
or re-opening it later.
42+
43+
If you've imported multiple builds, you can open one manually:
3844

3945
```console
40-
docker buildx history import --file ./ci-build.dockerbuild && docker buildx history open ci-build
46+
docker buildx history open ci-build
4147
```

docs/reference/buildx_history_inspect.md

+41-2
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,53 @@ provenance, SBOMs, or other detailed information.
2929

3030
## Examples
3131

32-
### Inspect a build and print metadata
32+
### <a name="inspect-most-recent-build"></a> Inspect the most recent build
3333

3434
```console
35-
docker buildx history inspect mybuild
35+
$ docker buildx history inspect
36+
Name: buildx (binaries)
37+
Context: .
38+
Dockerfile: Dockerfile
39+
VCS Repository: https://github.com/crazy-max/buildx.git
40+
VCS Revision: f15eaa1ee324ffbbab29605600d27a84cab86361
41+
Target: binaries
42+
Platforms: linux/amd64
43+
Keep Git Dir: true
44+
45+
Started: 2025-02-07 11:56:24
46+
Duration: 1m 1s
47+
Build Steps: 16/16 (25% cached)
48+
49+
Image Resolve Mode: local
50+
51+
Materials:
52+
URI DIGEST
53+
pkg:docker/docker/dockerfile@1 sha256:93bfd3b68c109427185cd78b4779fc82b484b0b7618e36d0f104d4d801e66d25
54+
pkg:docker/[email protected]?platform=linux%2Famd64 sha256:2c49857f2295e89b23b28386e57e018a86620a8fede5003900f2d138ba9c4037
55+
pkg:docker/tonistiigi/[email protected]?platform=linux%2Famd64 sha256:923441d7c25f1e2eb5789f82d987693c47b8ed987c4ab3b075d6ed2b5d6779a3
56+
57+
Attachments:
58+
DIGEST PLATFORM TYPE
59+
sha256:217329d2af959d4f02e3a96dcbe62bf100cab1feb8006a047ddfe51a5397f7e3 https://slsa.dev/provenance/v0.2
60+
```
61+
62+
### <a name="inspect-specific-build"></a> Inspect a specific build
63+
64+
```console
65+
# Using a build ID
66+
docker buildx history inspect qu2gsuo8ejqrwdfii23xkkckt
67+
68+
# Or using a relative offset
69+
docker buildx history inspect ^1
3670
```
3771

3872
### <a name="format"></a> Format the output (--format)
3973

4074
The formatting options (`--format`) pretty-prints the output to `pretty` (default),
4175
`json` or using a Go template.
4276

77+
**Pretty output**
78+
4379
```console
4480
$ docker buildx history inspect
4581
Name: buildx (binaries)
@@ -69,6 +105,7 @@ sha256:217329d2af959d4f02e3a96dcbe62bf100cab1feb8006a047ddfe51a5397f7e3
69105

70106
Print build logs: docker buildx history logs g9808bwrjrlkbhdamxklx660b
71107
```
108+
**JSON output**
72109

73110
```console
74111
$ docker buildx history inspect --format json
@@ -123,6 +160,8 @@ $ docker buildx history inspect --format json
123160
}
124161
```
125162

163+
**Go template output**
164+
126165
```console
127166
$ docker buildx history inspect --format "{{.Name}}: {{.VCSRepository}} ({{.VCSRevision}})"
128167
buildx (binaries): https://github.com/crazy-max/buildx.git (f15eaa1ee324ffbbab29605600d27a84cab86361)

docs/reference/buildx_history_inspect_attachment.md

+49-5
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,60 @@ platform-specific.
2323

2424
## Examples
2525

26-
### Inspect a provenance attachment from a build
26+
### <a name="inspect-provenance-attachment"></a> Inspect a provenance attachment from a build
27+
28+
Supported types include `provenance` and `sbom`.
2729

2830
```console
29-
docker buildx history inspect attachment mybuild --type https://slsa.dev/provenance/v0.2
31+
$ docker buildx history inspect attachment qu2gsuo8ejqrwdfii23xkkckt --type provenance
32+
{
33+
"_type": "https://slsa.dev/provenance/v0.2",
34+
"buildDefinition": {
35+
"buildType": "https://build.docker.com/BuildKit@v1",
36+
"externalParameters": {
37+
"target": "app",
38+
"platforms": ["linux/amd64"]
39+
}
40+
},
41+
"runDetails": {
42+
"builder": "docker",
43+
44+
}
45+
}
3046
```
3147

32-
### Inspect a SBOM for linux/amd64
48+
### <a name="insepct-SBOM"></a> Inspect a SBOM for linux/amd64
3349

3450
```console
35-
docker buildx history inspect attachment mybuild \
36-
--type application/vnd.cyclonedx+json \
51+
$ docker buildx history inspect attachment ^0 \
52+
--type sbom \
3753
--platform linux/amd64
54+
{
55+
"bomFormat": "CycloneDX",
56+
"specVersion": "1.5",
57+
"version": 1,
58+
"components": [
59+
{
60+
"type": "library",
61+
"name": "alpine",
62+
"version": "3.18.2"
63+
}
64+
]
65+
}
66+
```
67+
68+
### <a name="inspect-attachment-digest"></a> Inspect an attachment by digest
69+
70+
You can inspect an attachment directly using its digset, which you can get from
71+
the `inspect` output:
72+
73+
```console
74+
# Using a build ID
75+
docker buildx history inspect attachment qu2gsuo8ejqrwdfii23xkkckt sha256:abcdef123456...
76+
77+
# Or using a relative offset
78+
docker buildx history inspect attachment ^0 sha256:abcdef123456...
3879
```
80+
81+
Use `--type sbom` or `--type provenance` to filter attachments by type. To
82+
inspect a specific attachment by digest, omit the `--type` flag.

docs/reference/buildx_history_logs.md

+37-9
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,60 @@ Print the logs of a build
1616

1717
## Description
1818

19-
Print the logs for a completed build. The output appears in the same format as `--progress=plain`, showing the full logs for each step without multiplexing.
19+
Print the logs for a completed build. The output appears in the same format as
20+
`--progress=plain`, showing the full logs for each step.
2021

2122
By default, this shows logs for the most recent build on the current builder.
2223

24+
You can also specify an earlier build using an offset. For example:
25+
26+
- `^1` shows logs for the build before the most recent
27+
- `^2` shows logs for the build two steps back
28+
2329
## Examples
2430

25-
### Print logs for the most recent build
31+
### <a name="print-logs-recent-build"></a> Print logs for the most recent build
2632

2733
```console
28-
docker buildx history logs
34+
$ docker buildx history logs
35+
#1 [internal] load build definition from Dockerfile
36+
#1 transferring dockerfile: 31B done
37+
#1 DONE 0.0s
38+
#2 [internal] load .dockerignore
39+
#2 transferring context: 2B done
40+
#2 DONE 0.0s
41+
...
2942
```
3043

31-
### Print logs for a specific build
44+
By default, this shows logs for the most recent build on the current builder.
45+
46+
### <a name="print-logs-specific-build"></a> Print logs for a specific build
47+
48+
To print logs for a specific build, use a build ID or offset:
3249

3350
```console
34-
docker buildx history logs mybuild
51+
# Using a build ID
52+
docker buildx history logs qu2gsuo8ejqrwdfii23xkkckt
53+
54+
# Or using a relative offset
55+
docker buildx history logs ^1
3556
```
3657

37-
### Print logs in JSON format
58+
### <a name="print-logs-json"></a> Print logs in JSON format
3859

3960
```console
40-
docker buildx history logs mybuild --progress rawjson
61+
$ docker buildx history logs ^1 --progress rawjson
62+
{"id":"buildx_step_1","status":"START","timestamp":"2024-05-01T12:34:56.789Z","detail":"[internal] load build definition from Dockerfile"}
63+
{"id":"buildx_step_1","status":"COMPLETE","timestamp":"2024-05-01T12:34:57.001Z","duration":212000000}
64+
...
4165
```
4266

43-
### Print logs in TTY format
67+
### <a name="print-logs-tty"></a> Print logs in TTY format
4468

4569
```console
46-
docker buildx history logs mybuild --progress tty
70+
# Using a build ID
71+
docker buildx history logs qu2gsuo8ejqrwdfii23xkkckt --progress tty
72+
73+
# Or using a relative offset
74+
docker buildx history logs ^1 --progress tty
4775
```

0 commit comments

Comments
 (0)