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