mirror of https://github.com/docker/docs.git
add warning when you rm a running container
This commit is contained in:
parent
8a131dffb6
commit
1c841d4fee
|
@ -751,6 +751,9 @@ func (srv *Server) ContainerRestart(name string, t int) error {
|
||||||
|
|
||||||
func (srv *Server) ContainerDestroy(name string, removeVolume bool) error {
|
func (srv *Server) ContainerDestroy(name string, removeVolume bool) error {
|
||||||
if container := srv.runtime.Get(name); container != nil {
|
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{})
|
volumes := make(map[string]struct{})
|
||||||
// Store all the deleted containers volumes
|
// Store all the deleted containers volumes
|
||||||
for _, volumeId := range container.Volumes {
|
for _, volumeId := range container.Volumes {
|
||||||
|
|
Loading…
Reference in New Issue