Parcourir la source

add warning when you rm a running container

Victor Vieux il y a 12 ans
Parent
commit
1c841d4fee
1 fichiers modifiés avec 3 ajouts et 0 suppressions
  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 {