1
0
mirror of https://github.com/docker/cli.git synced 2026-01-16 20:22:36 +03:00

add warning when you rm a running container

Upstream-commit: 1c841d4feed99ad568b7a5b04cedf8d65c3bb92c
Component: engine
This commit is contained in:
Victor Vieux
2013-06-20 15:45:30 +00:00
parent df019d0466
commit 20435df2c1

View File

@@ -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 {