* Runtime: refuse to remove a running container
Solomon Hykes authored on 2013/06/21 02:25:02... | ... |
@@ -751,6 +751,9 @@ func (srv *Server) ContainerRestart(name string, t int) error { |
751 | 751 |
|
752 | 752 |
func (srv *Server) ContainerDestroy(name string, removeVolume bool) error { |
753 | 753 |
if container := srv.runtime.Get(name); container != nil { |
754 |
+ if container.State.Running { |
|
755 |
+ return fmt.Errorf("Impossible to remove a running container, please stop it first") |
|
756 |
+ } |
|
754 | 757 |
volumes := make(map[string]struct{}) |
755 | 758 |
// Store all the deleted containers volumes |
756 | 759 |
for _, volumeId := range container.Volumes { |