github.com/rhatdan/docker@v0.7.7-0.20180119204836-47a0dcbcd20a/client/volume_remove.go (about)

     1  package client
     2  
     3  import (
     4  	"net/url"
     5  
     6  	"github.com/docker/docker/api/types/versions"
     7  	"golang.org/x/net/context"
     8  )
     9  
    10  // VolumeRemove removes a volume from the docker host.
    11  func (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  	ensureReaderClosed(resp)
    20  	return wrapResponseError(err, resp, "volume", volumeID)
    21  }