From 1f482c9f1f919026aff139127639083959a8f021 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Sun, 3 Dec 2017 08:34:04 -0500 Subject: You can only attach to running containers Signed-off-by: Daniel J Walsh Closes: #98 Approved by: mheon --- libpod/container.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/libpod/container.go b/libpod/container.go index 31fbbbcc5..60c63d14e 100644 --- a/libpod/container.go +++ b/libpod/container.go @@ -598,11 +598,9 @@ func (c *Container) Attach(noStdin bool, keys string, attached chan<- bool) erro return err } - // TODO is it valid to attach to a frozen container? - if c.state.State == ContainerStateUnknown || - c.state.State == ContainerStateConfigured || - c.state.State == ContainerStatePaused { - return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created, running, or stopped containers") + if c.state.State != ContainerStateCreated && + c.state.State != ContainerStateRunning { + return errors.Wrapf(ErrCtrStateInvalid, "can only attach to created or running containers") } // Check the validity of the provided keys first -- cgit v1.2.3-54-g00ecf