github.com/walkingsparrow/docker@v1.4.2-0.20151218153551-b708a2249bfa/api/client/lib/container_stop.go (about) 1 package lib 2 3 import ( 4 "net/url" 5 "strconv" 6 ) 7 8 // ContainerStop stops a container without terminating the process. 9 // The process is blocked until the container stops or the timeout expires. 10 func (cli *Client) ContainerStop(containerID string, timeout int) error { 11 query := url.Values{} 12 query.Set("t", strconv.Itoa(timeout)) 13 resp, err := cli.post("/containers/"+containerID+"/stop", query, nil, nil) 14 ensureReaderClosed(resp) 15 return err 16 }