Compare commits

...

1 Commits

Author SHA1 Message Date
Matthew Penner
3546a2c461
docker: add debug logs around Start and Attach 2022-01-24 19:15:15 -07:00
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() { if e.IsAttached() {
return nil return nil
} }
e.log().Debug("not attached to container, continuing with attach...")
if err := e.followOutput(); err != nil { if err := e.followOutput(); err != nil {
return err return err
} }
e.log().Debug("following container output")
opts := types.ContainerAttachOptions{ opts := types.ContainerAttachOptions{
Stdin: true, Stdin: true,
@ -62,11 +64,13 @@ func (e *Environment) Attach(ctx context.Context) error {
} }
// Set the stream again with the container. // 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 { if st, err := e.client.ContainerAttach(ctx, e.Id, opts); err != nil {
return err return err
} else { } else {
e.SetStream(&st) e.SetStream(&st)
} }
e.log().Debug("attached!")
go func() { go func() {
// Don't use the context provided to the function, that'll cause the polling to // 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 return err
} }
e.log().Debug("attempting to start container...")
if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil { if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil {
return errors.WrapIf(err, "environment/docker: failed to start container") return errors.WrapIf(err, "environment/docker: failed to start container")
} }
e.log().Debug("started container!")
// No errors, good to continue through. // No errors, good to continue through.
sawError = false sawError = false