Skip to content

Commit

Permalink
Merge pull request moby#961 from dotcloud/933-warning_rm-running
Browse files Browse the repository at this point in the history
* Runtime: refuse to remove a running container
  • Loading branch information
Solomon Hykes committed Jun 20, 2013
2 parents d1a3d02 + 1c841d4 commit d8f5635
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit d8f5635

Please sign in to comment.