From 3546a2c461e6b97d004a4e573f6aeb4f784522e7 Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 24 Jan 2022 19:15:15 -0700 Subject: [PATCH] docker: add debug logs around Start and Attach --- environment/docker/container.go | 4 ++++ environment/docker/power.go | 2 ++ 2 files changed, 6 insertions(+) diff --git a/environment/docker/container.go b/environment/docker/container.go index 858a082..3f923bb 100644 --- a/environment/docker/container.go +++ b/environment/docker/container.go @@ -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 diff --git a/environment/docker/power.go b/environment/docker/power.go index 7c22cd3..c8b43d9 100644 --- a/environment/docker/power.go +++ b/environment/docker/power.go @@ -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