github.com/kinvolk/docker@v1.13.1/client/version.go (about) 1 package client 2 3 import ( 4 "encoding/json" 5 6 "github.com/docker/docker/api/types" 7 "golang.org/x/net/context" 8 ) 9 10 // ServerVersion returns information of the docker client and server host. 11 func (cli *Client) ServerVersion(ctx context.Context) (types.Version, error) { 12 resp, err := cli.get(ctx, "/version", nil, nil) 13 if err != nil { 14 return types.Version{}, err 15 } 16 17 var server types.Version 18 err = json.NewDecoder(resp.body).Decode(&server) 19 ensureReaderClosed(resp) 20 return server, err 21 }