mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
builder: remove daemon dependency in ContainerAttach
Signed-off-by: Tibor Vass <tibor@docker.com>
This commit is contained in:
parent
03a170c48d
commit
b0d9476153
3 changed files with 13 additions and 7 deletions
|
@ -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`.
|
||||
|
|
|
@ -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)
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
@ -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).
|
||||
|
|
Loading…
Reference in a new issue