2015-12-04 12:53:57 -05:00
|
|
|
package lib
|
|
|
|
|
2015-12-04 17:02:06 -05:00
|
|
|
import (
|
|
|
|
"net/url"
|
2015-12-04 12:53:57 -05:00
|
|
|
|
2015-12-04 17:02:06 -05:00
|
|
|
"github.com/docker/docker/api/types"
|
|
|
|
)
|
2015-12-04 12:53:57 -05:00
|
|
|
|
|
|
|
// ContainerRemove kills and removes a container from the docker host.
|
2015-12-04 17:02:06 -05:00
|
|
|
func (cli *Client) ContainerRemove(options types.ContainerRemoveOptions) error {
|
2015-12-04 21:06:12 -05:00
|
|
|
query := url.Values{}
|
2015-12-04 12:53:57 -05:00
|
|
|
if options.RemoveVolumes {
|
|
|
|
query.Set("v", "1")
|
|
|
|
}
|
|
|
|
if options.RemoveLinks {
|
|
|
|
query.Set("link", "1")
|
|
|
|
}
|
|
|
|
|
|
|
|
if options.Force {
|
|
|
|
query.Set("force", "1")
|
|
|
|
}
|
|
|
|
|
2015-12-05 20:28:36 -05:00
|
|
|
resp, err := cli.delete("/containers/"+options.ContainerID, query, nil)
|
2015-12-04 12:53:57 -05:00
|
|
|
ensureReaderClosed(resp)
|
|
|
|
return err
|
|
|
|
}
|