diff --git a/builder/builder.go b/builder/builder.go index 03090dabc3..5f2d5ded2f 100644 --- a/builder/builder.go +++ b/builder/builder.go @@ -113,8 +113,8 @@ type Backend interface { GetImage(name string) (Image, error) // Pull tells Docker to pull image referenced by `name`. Pull(name string) (Image, error) - // ContainerWsAttachWithLogs attaches to container. - ContainerWsAttachWithLogs(name string, cfg *daemon.ContainerWsAttachWithLogsConfig) error + // ContainerAttach attaches to container. + ContainerAttach(cID string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error // ContainerCreate creates a new Docker container and returns potential warnings ContainerCreate(types.ContainerCreateConfig) (types.ContainerCreateResponse, error) // ContainerRm removes a container specified by `id`. diff --git a/builder/dockerfile/internals.go b/builder/dockerfile/internals.go index daa1f2903f..77d500eff2 100644 --- a/builder/dockerfile/internals.go +++ b/builder/dockerfile/internals.go @@ -534,11 +534,7 @@ func (b *Builder) run(cID string) (err error) { errCh := make(chan error) if b.Verbose { go func() { - errCh <- b.docker.ContainerWsAttachWithLogs(cID, &daemon.ContainerWsAttachWithLogsConfig{ - OutStream: b.Stdout, - ErrStream: b.Stderr, - Stream: true, - }) + errCh <- b.docker.ContainerAttach(cID, nil, b.Stdout, b.Stderr, true) }() } diff --git a/daemon/daemonbuilder/builder.go b/daemon/daemonbuilder/builder.go index d50cd7255e..1d6953721a 100644 --- a/daemon/daemonbuilder/builder.go +++ b/daemon/daemonbuilder/builder.go @@ -92,6 +92,16 @@ func (d Docker) ContainerUpdateCmd(cID string, cmd []string) error { return nil } +// ContainerAttach attaches streams to the container cID. If stream is true, it streams the output. +func (d Docker) ContainerAttach(cID string, stdin io.ReadCloser, stdout, stderr io.Writer, stream bool) error { + return d.Daemon.ContainerWsAttachWithLogs(cID, &daemon.ContainerWsAttachWithLogsConfig{ + InStream: stdin, + OutStream: stdout, + ErrStream: stderr, + Stream: stream, + }) +} + // BuilderCopy copies/extracts a source FileInfo to a destination path inside a container // specified by a container object. // TODO: make sure callers don't unnecessarily convert destPath with filepath.FromSlash (Copy does it already).