mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 18:13:42 +08:00 
			
		
		
		
	Merge pull request #1854 from crazy-max/inspect-features
This commit is contained in:
		@@ -10,10 +10,12 @@ import (
 | 
				
			|||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/docker/buildx/builder"
 | 
						"github.com/docker/buildx/builder"
 | 
				
			||||||
 | 
						"github.com/docker/buildx/driver"
 | 
				
			||||||
	"github.com/docker/buildx/util/cobrautil/completion"
 | 
						"github.com/docker/buildx/util/cobrautil/completion"
 | 
				
			||||||
	"github.com/docker/buildx/util/platformutil"
 | 
						"github.com/docker/buildx/util/platformutil"
 | 
				
			||||||
	"github.com/docker/cli/cli"
 | 
						"github.com/docker/cli/cli"
 | 
				
			||||||
	"github.com/docker/cli/cli/command"
 | 
						"github.com/docker/cli/cli/command"
 | 
				
			||||||
 | 
						"github.com/docker/cli/cli/debug"
 | 
				
			||||||
	"github.com/docker/go-units"
 | 
						"github.com/docker/go-units"
 | 
				
			||||||
	"github.com/moby/buildkit/util/appcontext"
 | 
						"github.com/moby/buildkit/util/appcontext"
 | 
				
			||||||
	"github.com/spf13/cobra"
 | 
						"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, "Buildkit:\t%s\n", nodes[i].Version)
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				fmt.Fprintf(w, "Platforms:\t%s\n", strings.Join(platformutil.FormatInGroups(n.Node.Platforms, n.Platforms), ", "))
 | 
									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 {
 | 
									if len(nodes[i].Labels) > 0 {
 | 
				
			||||||
					fmt.Fprintf(w, "Labels:\n")
 | 
										fmt.Fprintf(w, "Labels:\n")
 | 
				
			||||||
					for _, k := range sortedKeys(nodes[i].Labels) {
 | 
										for _, k := range sortedKeys(nodes[i].Labels) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -84,3 +84,9 @@ GC Policy rule#3:
 | 
				
			|||||||
 All:        true
 | 
					 All:        true
 | 
				
			||||||
 Keep Bytes: 24.21GiB
 | 
					 Keep Bytes: 24.21GiB
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`debug` flag can also be used to get more information about the builder:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```console
 | 
				
			||||||
 | 
					$ docker --debug buildx inspect elated_tesla
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ type Feature string
 | 
				
			|||||||
const OCIExporter Feature = "OCI exporter"
 | 
					const OCIExporter Feature = "OCI exporter"
 | 
				
			||||||
const DockerExporter Feature = "Docker exporter"
 | 
					const DockerExporter Feature = "Docker exporter"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const CacheExport Feature = "cache export"
 | 
					const CacheExport Feature = "Cache export"
 | 
				
			||||||
const MultiPlatform Feature = "multiple platforms"
 | 
					const MultiPlatform Feature = "Multiple platforms"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const HistoryAPI Feature = "history api"
 | 
					const HistoryAPI Feature = "History API"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user