浏览代码

Merge pull request #961 from dotcloud/933-warning_rm-running

* Runtime: refuse to remove a running container
Solomon Hykes 12 年之前
父节点
当前提交
d8f56352da
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      server.go

+ 3 - 0
server.go

@@ -751,6 +751,9 @@ func (srv *Server) ContainerRestart(name string, t int) error {
 
 func (srv *Server) ContainerDestroy(name string, removeVolume bool) error {
 	if container := srv.runtime.Get(name); container != nil {
+		if container.State.Running {
+			return fmt.Errorf("Impossible to remove a running container, please stop it first")
+		}
 		volumes := make(map[string]struct{})
 		// Store all the deleted containers volumes
 		for _, volumeId := range container.Volumes {