github.com/dougm/docker@v1.5.0/daemon/wait.go (about)

     1  package daemon
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/docker/docker/engine"
     7  )
     8  
     9  func (daemon *Daemon) ContainerWait(job *engine.Job) engine.Status {
    10  	if len(job.Args) != 1 {
    11  		return job.Errorf("Usage: %s", job.Name)
    12  	}
    13  	name := job.Args[0]
    14  	if container := daemon.Get(name); container != nil {
    15  		status, _ := container.WaitStop(-1 * time.Second)
    16  		job.Printf("%d\n", status)
    17  		return engine.StatusOK
    18  	}
    19  	return job.Errorf("%s: No such container: %s", job.Name, name)
    20  }