github.com/jogo/docker@v1.7.0-rc1/daemon/stop.go (about) 1 package daemon 2 3 import "fmt" 4 5 func (daemon *Daemon) ContainerStop(name string, seconds int) error { 6 container, err := daemon.Get(name) 7 if err != nil { 8 return err 9 } 10 if !container.IsRunning() { 11 return fmt.Errorf("Container already stopped") 12 } 13 if err := container.Stop(seconds); err != nil { 14 return fmt.Errorf("Cannot stop container %s: %s\n", name, err) 15 } 16 container.LogEvent("stop") 17 return nil 18 }