docker: add debug logs around Start and Attach

This commit is contained in:
Matthew Penner 2022-01-24 19:15:15 -07:00
parent 68d4fb454f
commit 3546a2c461
No known key found for this signature in database
GPG Key ID: 31311906AD4CF6D6
2 changed files with 6 additions and 0 deletions

View File

@ -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

View File

@ -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