container_stop.go 442 B

12345678910111213141516
  1. package lib
  2. import (
  3. "net/url"
  4. "strconv"
  5. )
  6. // ContainerStop stops a container without terminating the process.
  7. // The process is blocked until the container stops or the timeout expires.
  8. func (cli *Client) ContainerStop(containerID string, timeout int) error {
  9. var query url.Values
  10. query.Set("t", strconv.Itoa(timeout))
  11. resp, err := cli.POST("/containers/"+containerID+"/stop", query, nil, nil)
  12. ensureReaderClosed(resp)
  13. return err
  14. }