github.com/vvnotw/moby@v1.13.1/client/info.go (about) 1 package client 2 3 import ( 4 "encoding/json" 5 "fmt" 6 "net/url" 7 8 "github.com/docker/docker/api/types" 9 "golang.org/x/net/context" 10 ) 11 12 // Info returns information about the docker server. 13 func (cli *Client) Info(ctx context.Context) (types.Info, error) { 14 var info types.Info 15 serverResp, err := cli.get(ctx, "/info", url.Values{}, nil) 16 if err != nil { 17 return info, err 18 } 19 defer ensureReaderClosed(serverResp) 20 21 if err := json.NewDecoder(serverResp.body).Decode(&info); err != nil { 22 return info, fmt.Errorf("Error reading remote info: %v", err) 23 } 24 25 return info, nil 26 }