1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/daemon/stop.go
Antonio Murdaca 04cc6c6aa4 Remove job from stop
Signed-off-by: Antonio Murdaca <me@runcom.ninja>
2015-04-12 00:41:16 +02:00

18 lines
409 B
Go

package daemon
import "fmt"
func (daemon *Daemon) ContainerStop(name string, seconds int) error {
container, err := daemon.Get(name)
if err != nil {
return err
}
if !container.IsRunning() {
return fmt.Errorf("Container already stopped")
}
if err := container.Stop(seconds); err != nil {
return fmt.Errorf("Cannot stop container %s: %s\n", name, err)
}
container.LogEvent("stop")
return nil
}