| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -20,6 +20,7 @@ import (
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/docker/cli/cli"
 | 
					 | 
					 | 
					 | 
						"github.com/docker/cli/cli"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/docker/cli/cli/command"
 | 
					 | 
					 | 
					 | 
						"github.com/docker/cli/cli/command"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						dockeropts "github.com/docker/cli/opts"
 | 
					 | 
					 | 
					 | 
						dockeropts "github.com/docker/cli/opts"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						"github.com/docker/distribution/reference"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/docker/docker/pkg/ioutils"
 | 
					 | 
					 | 
					 | 
						"github.com/docker/docker/pkg/ioutils"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/docker/go-units"
 | 
					 | 
					 | 
					 | 
						"github.com/docker/go-units"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						"github.com/moby/buildkit/client"
 | 
					 | 
					 | 
					 | 
						"github.com/moby/buildkit/client"
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -44,6 +45,7 @@ type buildOptions struct {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						cacheFrom    []string
 | 
					 | 
					 | 
					 | 
						cacheFrom    []string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						cacheTo      []string
 | 
					 | 
					 | 
					 | 
						cacheTo      []string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						cgroupParent string
 | 
					 | 
					 | 
					 | 
						cgroupParent string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						contexts     []string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						extraHosts   []string
 | 
					 | 
					 | 
					 | 
						extraHosts   []string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						imageIDFile  string
 | 
					 | 
					 | 
					 | 
						imageIDFile  string
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						labels       []string
 | 
					 | 
					 | 
					 | 
						labels       []string
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -100,11 +102,17 @@ func runBuild(dockerCli command.Cli, in buildOptions) (err error) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							in.progress = "quiet"
 | 
					 | 
					 | 
					 | 
							in.progress = "quiet"
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						contexts, err := parseContextNames(in.contexts)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						if err != nil {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return err
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						opts := build.Options{
 | 
					 | 
					 | 
					 | 
						opts := build.Options{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							Inputs: build.Inputs{
 | 
					 | 
					 | 
					 | 
							Inputs: build.Inputs{
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								ContextPath:    in.contextPath,
 | 
					 | 
					 | 
					 | 
								ContextPath:    in.contextPath,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								DockerfilePath: in.dockerfileName,
 | 
					 | 
					 | 
					 | 
								DockerfilePath: in.dockerfileName,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
								InStream:       os.Stdin,
 | 
					 | 
					 | 
					 | 
								InStream:       os.Stdin,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								NamedContexts:  contexts,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							},
 | 
					 | 
					 | 
					 | 
							},
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							BuildArgs:   listToMap(in.buildArgs, true),
 | 
					 | 
					 | 
					 | 
							BuildArgs:   listToMap(in.buildArgs, true),
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
							ExtraHosts:  in.extraHosts,
 | 
					 | 
					 | 
					 | 
							ExtraHosts:  in.extraHosts,
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -339,6 +347,8 @@ func buildCmd(dockerCli command.Cli, rootOpts *rootOptions) *cobra.Command {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
 | 
					 | 
					 | 
					 | 
						flags.StringVar(&options.cgroupParent, "cgroup-parent", "", "Optional parent cgroup for the container")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						flags.SetAnnotation("cgroup-parent", annotation.ExternalURL, []string{"https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent"})
 | 
					 | 
					 | 
					 | 
						flags.SetAnnotation("cgroup-parent", annotation.ExternalURL, []string{"https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent"})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						flags.StringArrayVar(&options.contexts, "context", []string{}, "Additional named contexts (e.g., name=path)")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						flags.StringVarP(&options.dockerfileName, "file", "f", "", `Name of the Dockerfile (default: "PATH/Dockerfile")`)
 | 
					 | 
					 | 
					 | 
						flags.StringVarP(&options.dockerfileName, "file", "f", "", `Name of the Dockerfile (default: "PATH/Dockerfile")`)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						flags.SetAnnotation("file", annotation.ExternalURL, []string{"https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f"})
 | 
					 | 
					 | 
					 | 
						flags.SetAnnotation("file", annotation.ExternalURL, []string{"https://docs.docker.com/engine/reference/commandline/build/#specify-a-dockerfile--f"})
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -462,3 +472,23 @@ func listToMap(values []string, defaultEnv bool) map[string]string {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						}
 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
						return result
 | 
					 | 
					 | 
					 | 
						return result
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					}
 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					func parseContextNames(values []string) (map[string]string, error) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						if len(values) == 0 {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							return nil, nil
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						result := make(map[string]string, len(values))
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						for _, value := range values {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							kv := strings.SplitN(value, "=", 2)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if len(kv) != 2 {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return nil, errors.Errorf("invalid context value: %s, expected key=value", value)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							named, err := reference.ParseNormalizedNamed(kv[0])
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							if err != nil {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
								return nil, errors.Wrapf(err, "invalid context name %s", kv[0])
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							name := strings.TrimSuffix(reference.FamiliarString(named), ":latest")
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
							result[name] = kv[1]
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						}
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
						return result, nil
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					}
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
 
 |