github.com/rumpl/bof@v23.0.0-rc.2+incompatible/client/info.go (about) 1 package client // import "github.com/docker/docker/client" 2 3 import ( 4 "context" 5 "encoding/json" 6 "fmt" 7 "net/url" 8 9 "github.com/docker/docker/api/types" 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 defer ensureReaderClosed(serverResp) 17 if err != nil { 18 return info, err 19 } 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 }