浏览代码

Fix removing mountpoints on container rm fail

Ensure that the the container's mountpoints are cleaned up if the
container is force removed.

Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Brian Goff 9 年之前
父节点
当前提交
08ca18b59d
共有 1 个文件被更改,包括 6 次插入7 次删除
  1. 6 7
      daemon/delete.go

+ 6 - 7
daemon/delete.go

@@ -43,15 +43,14 @@ func (daemon *Daemon) ContainerRm(name string, config *types.ContainerRmConfig)
 		return daemon.rmLink(container, name)
 	}
 
-	if err := daemon.cleanupContainer(container, config.ForceRemove); err != nil {
-		return err
-	}
-
-	if err := daemon.removeMountPoints(container, config.RemoveVolume); err != nil {
-		logrus.Error(err)
+	err = daemon.cleanupContainer(container, config.ForceRemove)
+	if err == nil || config.ForceRemove {
+		if e := daemon.removeMountPoints(container, config.RemoveVolume); e != nil {
+			logrus.Error(e)
+		}
 	}
 
-	return nil
+	return err
 }
 
 func (daemon *Daemon) rmLink(container *container.Container, name string) error {