mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-25 09:50:31 +00:00
22 lines
563 B
Go
22 lines
563 B
Go
|
package docker // import "docker.io/go-docker"
|
||
|
|
||
|
import (
|
||
|
"net/url"
|
||
|
|
||
|
"docker.io/go-docker/api/types/versions"
|
||
|
"golang.org/x/net/context"
|
||
|
)
|
||
|
|
||
|
// VolumeRemove removes a volume from the docker host.
|
||
|
func (cli *Client) VolumeRemove(ctx context.Context, volumeID string, force bool) error {
|
||
|
query := url.Values{}
|
||
|
if versions.GreaterThanOrEqualTo(cli.version, "1.25") {
|
||
|
if force {
|
||
|
query.Set("force", "1")
|
||
|
}
|
||
|
}
|
||
|
resp, err := cli.delete(ctx, "/volumes/"+volumeID, query, nil)
|
||
|
ensureReaderClosed(resp)
|
||
|
return wrapResponseError(err, resp, "volume", volumeID)
|
||
|
}
|