summaryrefslogtreecommitdiff
path: root/client/container_kill.go
blob: 7c9529f1e140e1992ef4bb77ec7b530bb1050859 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package client // import "github.com/docker/docker/client"

import (
	"context"
	"net/url"
)

// ContainerKill terminates the container process but does not remove the container from the docker host.
func (cli *Client) ContainerKill(ctx context.Context, containerID, signal string) error {
	query := url.Values{}
	if signal != "" {
		query.Set("signal", signal)
	}

	resp, err := cli.post(ctx, "/containers/"+containerID+"/kill", query, nil, nil)
	ensureReaderClosed(resp)
	return err
}