github.com/eljojo/docker@v1.6.0-rc4/daemon/restart.go (about) 1 package daemon 2 3 import ( 4 "github.com/docker/docker/engine" 5 ) 6 7 func (daemon *Daemon) ContainerRestart(job *engine.Job) engine.Status { 8 if len(job.Args) != 1 { 9 return job.Errorf("Usage: %s CONTAINER\n", job.Name) 10 } 11 var ( 12 name = job.Args[0] 13 t = 10 14 ) 15 if job.EnvExists("t") { 16 t = job.GetenvInt("t") 17 } 18 container, err := daemon.Get(name) 19 if err != nil { 20 return job.Error(err) 21 } 22 if err := container.Restart(int(t)); err != nil { 23 return job.Errorf("Cannot restart container %s: %s\n", name, err) 24 } 25 container.LogEvent("restart") 26 return engine.StatusOK 27 }