1 // Copyright 2015 go-dockerclient authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 // Version returns version information about the docker server.
14 // See https://goo.gl/ND9R8L for more details.
15 func (c *Client) Version() (*Env, error) {
16 resp, err := c.do("GET", "/version", doOptions{})
20 defer resp.Body.Close()
22 if err := env.Decode(resp.Body); err != nil {
28 // DockerInfo contains information about the Docker server
30 // See https://goo.gl/bHUoz9 for more details.
31 type DockerInfo struct {
39 DriverStatus [][2]string
40 SystemStatus [][2]string
45 CPUCfsPeriod bool `json:"CpuCfsPeriod"`
46 CPUCfsQuota bool `json:"CpuCfsQuota"`
51 BridgeNfIP6tables bool `json:"BridgeNfIp6tables"`
57 ExecutionDriver string
62 OperatingSystem string
65 IndexServerAddress string
69 HTTPProxy string `json:"HttpProxy"`
70 HTTPSProxy string `json:"HttpsProxy"`
74 ExperimentalBuild bool
77 ClusterAdvertise string
80 // PluginsInfo is a struct with the plugins registered with the docker daemon
82 // for more information, see: https://goo.gl/bHUoz9
83 type PluginsInfo struct {
84 // List of Volume plugins registered
86 // List of Network plugins registered
88 // List of Authorization plugins registered
89 Authorization []string
92 // Info returns system-wide information about the Docker server.
94 // See https://goo.gl/ElTHi2 for more details.
95 func (c *Client) Info() (*DockerInfo, error) {
96 resp, err := c.do("GET", "/info", doOptions{})
100 defer resp.Body.Close()
102 if err := json.NewDecoder(resp.Body).Decode(&info); err != nil {
108 // ParseRepositoryTag gets the name of the repository and returns it splitted
109 // in two parts: the repository and the tag.
113 // localhost.localdomain:5000/samalba/hipache:latest -> localhost.localdomain:5000/samalba/hipache, latest
114 // localhost.localdomain:5000/samalba/hipache -> localhost.localdomain:5000/samalba/hipache, ""
115 func ParseRepositoryTag(repoTag string) (repository string, tag string) {
116 n := strings.LastIndex(repoTag, ":")
120 if tag := repoTag[n+1:]; !strings.Contains(tag, "/") {
121 return repoTag[:n], tag