container_kill.go 438 B

123456789101112131415161718
  1. package client
  2. import (
  3. "net/url"
  4. "golang.org/x/net/context"
  5. )
  6. // ContainerKill terminates the container process but does not remove the container from the docker host.
  7. func (cli *Client) ContainerKill(ctx context.Context, containerID, signal string) error {
  8. query := url.Values{}
  9. query.Set("signal", signal)
  10. resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil)
  11. ensureReaderClosed(resp)
  12. return err
  13. }