github.com/LazyboyChen7/engine@v17.12.1-ce-rc2+incompatible/client/container_remove.go (about) 1 package client 2 3 import ( 4 "net/url" 5 6 "github.com/docker/docker/api/types" 7 "golang.org/x/net/context" 8 ) 9 10 // ContainerRemove kills and removes a container from the docker host. 11 func (cli *Client) ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error { 12 query := url.Values{} 13 if options.RemoveVolumes { 14 query.Set("v", "1") 15 } 16 if options.RemoveLinks { 17 query.Set("link", "1") 18 } 19 20 if options.Force { 21 query.Set("force", "1") 22 } 23 24 resp, err := cli.delete(ctx, "/containers/"+containerID, query, nil) 25 ensureReaderClosed(resp) 26 return wrapResponseError(err, resp, "container", containerID) 27 }