@@ -10,7 +10,6 @@ import (
1010 "fmt"
1111 "io"
1212 "io/ioutil"
13- "net"
1413 "os"
1514 "path/filepath"
1615 "regexp"
@@ -33,7 +32,6 @@ import (
3332 "github.com/docker/docker/pkg/urlutil"
3433 units "github.com/docker/go-units"
3534 "github.com/pkg/errors"
36- "github.com/sirupsen/logrus"
3735 "github.com/spf13/cobra"
3836)
3937
@@ -165,9 +163,7 @@ func NewBuildCommand(dockerCli command.Cli) *cobra.Command {
165163 flags .SetAnnotation ("squash" , "version" , []string {"1.25" })
166164
167165 flags .BoolVar (& options .stream , "stream" , false , "Stream attaches to server to negotiate build context" )
168- flags .SetAnnotation ("stream" , "experimental" , nil )
169- flags .SetAnnotation ("stream" , "version" , []string {"1.31" })
170- flags .SetAnnotation ("stream" , "no-buildkit" , nil )
166+ flags .MarkHidden ("stream" )
171167
172168 flags .StringVar (& options .progress , "progress" , "auto" , "Set type of progress output (auto, plain, tty). Use plain to show container output" )
173169 flags .SetAnnotation ("progress" , "buildkit" , nil )
@@ -224,8 +220,8 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
224220 remote string
225221 )
226222
227- if options .compress && options . stream {
228- return errors .New ("--compress conflicts with --stream options " )
223+ if options .stream {
224+ return errors .New ("Experimental flag --stream was removed, enable BuildKit instead with DOCKER_BUILDKIT=1 " )
229225 }
230226
231227 if options .dockerfileFromStdin () {
@@ -284,7 +280,7 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
284280 }
285281
286282 // read from a directory into tar archive
287- if buildCtx == nil && ! options . stream {
283+ if buildCtx == nil {
288284 excludes , err := build .ReadDockerignore (contextDir )
289285 if err != nil {
290286 return err
@@ -315,16 +311,6 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
315311 }
316312 }
317313
318- // if streaming and Dockerfile was not from stdin then read from file
319- // to the same reader that is usually stdin
320- if options .stream && dockerfileCtx == nil {
321- dockerfileCtx , err = os .Open (relDockerfile )
322- if err != nil {
323- return errors .Wrapf (err , "failed to open %s" , relDockerfile )
324- }
325- defer dockerfileCtx .Close ()
326- }
327-
328314 ctx , cancel := context .WithCancel (context .Background ())
329315 defer cancel ()
330316
@@ -367,38 +353,11 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
367353 buildCtx = dockerfileCtx
368354 }
369355
370- s , err := trySession (dockerCli , contextDir , true )
371- if err != nil {
372- return err
373- }
374-
375356 var body io.Reader
376- if buildCtx != nil && ! options . stream {
357+ if buildCtx != nil {
377358 body = progress .NewProgressReader (buildCtx , progressOutput , 0 , "" , "Sending build context to Docker daemon" )
378359 }
379360
380- // add context stream to the session
381- if options .stream && s != nil {
382- syncDone := make (chan error ) // used to signal first progress reporting completed.
383- // progress would also send errors but don't need it here as errors
384- // are handled by session.Run() and ImageBuild()
385- if err := addDirToSession (s , contextDir , progressOutput , syncDone ); err != nil {
386- return err
387- }
388-
389- buf := newBufferedWriter (syncDone , buildBuff )
390- defer func () {
391- select {
392- case <- buf .flushed :
393- case <- ctx .Done ():
394- }
395- }()
396- buildBuff = buf
397-
398- remote = clientSessionRemote
399- body = buildCtx
400- }
401-
402361 configFile := dockerCli .ConfigFile ()
403362 creds , _ := configFile .GetAllCredentials ()
404363 authConfigs := make (map [string ]types.AuthConfig , len (creds ))
@@ -411,20 +370,6 @@ func runBuild(dockerCli command.Cli, options buildOptions) error {
411370 buildOptions .AuthConfigs = authConfigs
412371 buildOptions .RemoteContext = remote
413372
414- if s != nil {
415- go func () {
416- logrus .Debugf ("running session: %v" , s .ID ())
417- dialSession := func (ctx context.Context , proto string , meta map [string ][]string ) (net.Conn , error ) {
418- return dockerCli .Client ().DialHijack (ctx , "/session" , proto , meta )
419- }
420- if err := s .Run (ctx , dialSession ); err != nil {
421- logrus .Error (err )
422- cancel () // cancel progress context
423- }
424- }()
425- buildOptions .SessionID = s .ID ()
426- }
427-
428373 response , err := dockerCli .Client ().ImageBuild (ctx , body , buildOptions )
429374 if err != nil {
430375 if options .quiet {
0 commit comments