From bc6d87284174c1a862603a2da574ff60bb03e0fa Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Mon, 11 Nov 2013 18:15:38 -0800 Subject: [PATCH] on docker start, do not cleanup if already running --- container.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/container.go b/container.go index ea4a240387..118ce1b034 100644 --- a/container.go +++ b/container.go @@ -702,15 +702,14 @@ func (container *Container) Attach(stdin io.ReadCloser, stdinCloser io.Closer, s func (container *Container) Start() (err error) { container.State.Lock() defer container.State.Unlock() + if container.State.Running { + return fmt.Errorf("The container %s is already running.", container.ID) + } defer func() { if err != nil { container.cleanup() } }() - - if container.State.Running { - return fmt.Errorf("The container %s is already running.", container.ID) - } if err := container.EnsureMounted(); err != nil { return err }