inspect: display builder features

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2023-05-30 20:38:14 +02:00 committed by CrazyMax
parent a906149930
commit 6c9436fbd5
No known key found for this signature in database
GPG Key ID: 3248E46B6BB8C7F7
3 changed files with 23 additions and 3 deletions

View File

@ -10,10 +10,12 @@ import (
"time"
"github.com/docker/buildx/builder"
"github.com/docker/buildx/driver"
"github.com/docker/buildx/util/cobrautil/completion"
"github.com/docker/buildx/util/platformutil"
"github.com/docker/cli/cli"
"github.com/docker/cli/cli/command"
"github.com/docker/cli/cli/debug"
"github.com/docker/go-units"
"github.com/moby/buildkit/util/appcontext"
"github.com/spf13/cobra"
@ -92,6 +94,18 @@ func runInspect(dockerCli command.Cli, in inspectOptions) error {
fmt.Fprintf(w, "Buildkit:\t%s\n", nodes[i].Version)
}
fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.FormatInGroups(n.Node.Platforms, n.Platforms), ", "))
if debug.IsEnabled() {
fmt.Fprintf(w, "Features:\n")
features := nodes[i].Driver.Features(ctx)
featKeys := make([]string, 0, len(features))
for k := range features {
featKeys = append(featKeys, string(k))
}
sort.Strings(featKeys)
for _, k := range featKeys {
fmt.Fprintf(w, "\t%s:\t%t\n", k, features[driver.Feature(k)])
}
}
if len(nodes[i].Labels) > 0 {
fmt.Fprintf(w, "Labels:\n")
for _, k := range sortedKeys(nodes[i].Labels) {

View File

@ -84,3 +84,9 @@ GC Policy rule#3:
All: true
Keep Bytes: 24.21GiB
```
`debug` flag can also be used to get more information about the builder:
```console
$ docker --debug buildx inspect elated_tesla
```

View File

@ -5,7 +5,7 @@ type Feature string
const OCIExporter Feature = "OCI exporter"
const DockerExporter Feature = "Docker exporter"
const CacheExport Feature = "cache export"
const MultiPlatform Feature = "multiple platforms"
const CacheExport Feature = "Cache export"
const MultiPlatform Feature = "Multiple platforms"
const HistoryAPI Feature = "history api"
const HistoryAPI Feature = "History API"