9 "github.com/docker/docker/api/types"
10 "golang.org/x/net/context"
13 // VolumeInspect returns the information about a specific volume in the docker host.
14 func (cli *Client) VolumeInspect(ctx context.Context, volumeID string) (types.Volume, error) {
15 volume, _, err := cli.VolumeInspectWithRaw(ctx, volumeID)
19 // VolumeInspectWithRaw returns the information about a specific volume in the docker host and its raw representation
20 func (cli *Client) VolumeInspectWithRaw(ctx context.Context, volumeID string) (types.Volume, []byte, error) {
21 var volume types.Volume
22 resp, err := cli.get(ctx, "/volumes/"+volumeID, nil, nil)
24 if resp.statusCode == http.StatusNotFound {
25 return volume, nil, volumeNotFoundError{volumeID}
27 return volume, nil, err
29 defer ensureReaderClosed(resp)
31 body, err := ioutil.ReadAll(resp.body)
33 return volume, nil, err
35 rdr := bytes.NewReader(body)
36 err = json.NewDecoder(rdr).Decode(&volume)
37 return volume, body, err