Sfoglia il codice sorgente

Merge pull request #2662 from dotcloud/do_not_cleanup_start_if_running

on docker start, do not cleanup if already running
Victor Vieux 11 anni fa
parent
commit
71c05bb87c
1 ha cambiato i file con 3 aggiunte e 4 eliminazioni
  1. 3 4
      container.go

+ 3 - 4
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
 	}