docker: add debug logs around Start and Attach
This commit is contained in:
parent
68d4fb454f
commit
3546a2c461
|
@ -49,10 +49,12 @@ func (e *Environment) Attach(ctx context.Context) error {
|
|||
if e.IsAttached() {
|
||||
return nil
|
||||
}
|
||||
e.log().Debug("not attached to container, continuing with attach...")
|
||||
|
||||
if err := e.followOutput(); err != nil {
|
||||
return err
|
||||
}
|
||||
e.log().Debug("following container output")
|
||||
|
||||
opts := types.ContainerAttachOptions{
|
||||
Stdin: true,
|
||||
|
@ -62,11 +64,13 @@ func (e *Environment) Attach(ctx context.Context) error {
|
|||
}
|
||||
|
||||
// Set the stream again with the container.
|
||||
e.log().Debug("attempting to attach...")
|
||||
if st, err := e.client.ContainerAttach(ctx, e.Id, opts); err != nil {
|
||||
return err
|
||||
} else {
|
||||
e.SetStream(&st)
|
||||
}
|
||||
e.log().Debug("attached!")
|
||||
|
||||
go func() {
|
||||
// Don't use the context provided to the function, that'll cause the polling to
|
||||
|
|
|
@ -115,9 +115,11 @@ func (e *Environment) Start(ctx context.Context) error {
|
|||
return err
|
||||
}
|
||||
|
||||
e.log().Debug("attempting to start container...")
|
||||
if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil {
|
||||
return errors.WrapIf(err, "environment/docker: failed to start container")
|
||||
}
|
||||
e.log().Debug("started container!")
|
||||
|
||||
// No errors, good to continue through.
|
||||
sawError = false
|
||||
|
|
Loading…
Reference in New Issue
Block a user