mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
229d3bace8
This removes the dockerversion dependency from the client library. Signed-off-by: David Calavera <david.calavera@gmail.com>
20 lines
441 B
Go
20 lines
441 B
Go
package lib
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
)
|
|
|
|
// ServerVersion returns information of the docker client and server host.
|
|
func (cli *Client) ServerVersion() (types.Version, error) {
|
|
resp, err := cli.get("/version", nil, nil)
|
|
if err != nil {
|
|
return types.Version{}, err
|
|
}
|
|
defer ensureReaderClosed(resp)
|
|
|
|
var server types.Version
|
|
err = json.NewDecoder(resp.body).Decode(&server)
|
|
return server, err
|
|
}
|