From 136540111d200edb889676a11b22572b1c6d27be Mon Sep 17 00:00:00 2001 From: Matthew Penner Date: Mon, 24 Jan 2022 19:01:33 -0700 Subject: [PATCH] docker: attach to container before starting --- environment/docker/power.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/environment/docker/power.go b/environment/docker/power.go index 69fd30e..7c22cd3 100644 --- a/environment/docker/power.go +++ b/environment/docker/power.go @@ -111,14 +111,17 @@ func (e *Environment) Start(ctx context.Context) error { actx, cancel := context.WithTimeout(ctx, time.Second*30) defer cancel() + if err := e.Attach(actx); err != nil { + return err + } + if err := e.client.ContainerStart(actx, e.Id, types.ContainerStartOptions{}); err != nil { return errors.WrapIf(err, "environment/docker: failed to start container") } // No errors, good to continue through. sawError = false - - return e.Attach(actx) + return nil } // Stop stops the container that the server is running in. This will allow up to