1package client // import "github.com/docker/docker/client" 2 3import ( 4 "context" 5 "net/url" 6 7 "github.com/docker/docker/api/types/versions" 8) 9 10// VolumeRemove removes a volume from the docker host. 11func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, force bool) error { 12 query := url.Values{} 13 if versions.GreaterThanOrEqualTo(cli.version, "1.25") { 14 if force { 15 query.Set("force", "1") 16 } 17 } 18 resp, err := cli.delete(ctx, "/volumes/"+volumeID, query, nil) 19 defer ensureReaderClosed(resp) 20 return wrapResponseError(err, resp, "volume", volumeID) 21} 22