From 20435df2c1c9ca2fe6dc70e7a2b772d2bbc10bd8 Mon Sep 17 00:00:00 2001 From: Victor Vieux Date: Thu, 20 Jun 2013 15:45:30 +0000 Subject: [PATCH] add warning when you rm a running container Upstream-commit: 1c841d4feed99ad568b7a5b04cedf8d65c3bb92c Component: engine --- components/engine/server.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/engine/server.go b/components/engine/server.go index e9be3a1668..e51613e2cf 100644 --- a/components/engine/server.go +++ b/components/engine/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 {