2014-07-31 20:48:23 +00:00
|
|
|
package daemon
|
|
|
|
|
2015-04-14 01:34:34 +02:00
|
|
|
import "fmt"
|
2015-03-25 08:44:12 +01:00
|
|
|
|
2015-04-14 01:34:34 +02:00
|
|
|
func (daemon *Daemon) ContainerRestart(name string, seconds int) error {
|
2014-12-16 15:06:35 -08:00
|
|
|
container, err := daemon.Get(name)
|
|
|
|
if err != nil {
|
2015-03-25 08:44:12 +01:00
|
|
|
return err
|
2014-07-31 20:48:23 +00:00
|
|
|
}
|
2015-04-14 01:34:34 +02:00
|
|
|
if err := container.Restart(seconds); err != nil {
|
2015-03-25 08:44:12 +01:00
|
|
|
return fmt.Errorf("Cannot restart container %s: %s\n", name, err)
|
2014-12-16 15:06:35 -08:00
|
|
|
}
|
|
|
|
container.LogEvent("restart")
|
2015-03-25 08:44:12 +01:00
|
|
|
return nil
|
2014-07-31 20:48:23 +00:00
|
|
|
}
|