Skip to content

Commit 6c9436f

Browse files
committed
inspect: display builder features
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
1 parent a906149 commit 6c9436f

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

commands/inspect.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import (
1010
"time"
1111

1212
"github.com/docker/buildx/builder"
13+
"github.com/docker/buildx/driver"
1314
"github.com/docker/buildx/util/cobrautil/completion"
1415
"github.com/docker/buildx/util/platformutil"
1516
"github.com/docker/cli/cli"
1617
"github.com/docker/cli/cli/command"
18+
"github.com/docker/cli/cli/debug"
1719
"github.com/docker/go-units"
1820
"github.com/moby/buildkit/util/appcontext"
1921
"github.com/spf13/cobra"
@@ -92,6 +94,18 @@ func runInspect(dockerCli command.Cli, in inspectOptions) error {
9294
fmt.Fprintf(w, "Buildkit:\t%s\n", nodes[i].Version)
9395
}
9496
fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.FormatInGroups(n.Node.Platforms, n.Platforms), ", "))
97+
if debug.IsEnabled() {
98+
fmt.Fprintf(w, "Features:\n")
99+
features := nodes[i].Driver.Features(ctx)
100+
featKeys := make([]string, 0, len(features))
101+
for k := range features {
102+
featKeys = append(featKeys, string(k))
103+
}
104+
sort.Strings(featKeys)
105+
for _, k := range featKeys {
106+
fmt.Fprintf(w, "\t%s:\t%t\n", k, features[driver.Feature(k)])
107+
}
108+
}
95109
if len(nodes[i].Labels) > 0 {
96110
fmt.Fprintf(w, "Labels:\n")
97111
for _, k := range sortedKeys(nodes[i].Labels) {

docs/reference/buildx_inspect.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,9 @@ GC Policy rule#3:
8484
All: true
8585
Keep Bytes: 24.21GiB
8686
```
87+
88+
`debug` flag can also be used to get more information about the builder:
89+
90+
```console
91+
$ docker --debug buildx inspect elated_tesla
92+
```

driver/features.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ type Feature string
55
const OCIExporter Feature = "OCI exporter"
66
const DockerExporter Feature = "Docker exporter"
77

8-
const CacheExport Feature = "cache export"
9-
const MultiPlatform Feature = "multiple platforms"
8+
const CacheExport Feature = "Cache export"
9+
const MultiPlatform Feature = "Multiple platforms"
1010

11-
const HistoryAPI Feature = "history api"
11+
const HistoryAPI Feature = "History API"

0 commit comments

Comments
 (0)