Browse code

add docker server version to /info

Signed-off-by: Zhang Kun <zkazure@gmail.com>

Zhang Kun authored on 2015/09/21 13:23:54
Showing 8 changed files
... ...
@@ -35,6 +35,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
35 35
 
36 36
 	fmt.Fprintf(cli.out, "Containers: %d\n", info.Containers)
37 37
 	fmt.Fprintf(cli.out, "Images: %d\n", info.Images)
38
+	fmt.Fprintf(cli.out, "Engine Version: %s\n", info.ServerVersion)
38 39
 	ioutils.FprintfIfNotEmpty(cli.out, "Storage Driver: %s\n", info.Driver)
39 40
 	if info.DriverStatus != nil {
40 41
 		for _, pair := range info.DriverStatus {
... ...
@@ -215,6 +215,7 @@ type Info struct {
215 215
 	Name               string
216 216
 	Labels             []string
217 217
 	ExperimentalBuild  bool
218
+	ServerVersion      string
218 219
 }
219 220
 
220 221
 // ExecStartCheck is a temp struct used by execStart
... ...
@@ -90,6 +90,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
90 90
 		DockerRootDir:      daemon.config().Root,
91 91
 		Labels:             daemon.config().Labels,
92 92
 		ExperimentalBuild:  utils.ExperimentalBuild(),
93
+		ServerVersion:      dockerversion.VERSION,
93 94
 	}
94 95
 
95 96
 	// TODO Windows. Refactor this more once sysinfo is refactored into
... ...
@@ -88,6 +88,7 @@ This section lists each version from latest to oldest.  Each listing includes a
88 88
 list of DNS options to be used in the container.
89 89
 * `POST /build` now optionally takes a serialized map of build-time variables.
90 90
 * `GET /events` now includes a `timenano` field, in addition to the existing `time` field.
91
+* `GET /info` now lists engine version information.
91 92
 
92 93
 ### v1.20 API changes
93 94
 
... ...
@@ -1860,6 +1860,7 @@ Display system-wide information
1860 1860
         },
1861 1861
         "SwapLimit": false,
1862 1862
         "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
1863
+        "ServerVersion": "1.9.0"
1863 1864
     }
1864 1865
 
1865 1866
 Status Codes:
... ...
@@ -21,6 +21,7 @@ For example:
21 21
     $ docker -D info
22 22
     Containers: 14
23 23
     Images: 52
24
+    Engine Version: 1.9.0
24 25
     Storage Driver: aufs
25 26
      Root Dir: /var/lib/docker/aufs
26 27
      Backing Filesystem: extfs
... ...
@@ -25,7 +25,8 @@ func (s *DockerSuite) TestInfoApi(c *check.C) {
25 25
 		"NCPU",
26 26
 		"MemTotal",
27 27
 		"KernelVersion",
28
-		"Driver"}
28
+		"Driver",
29
+		"ServerVersion"}
29 30
 
30 31
 	out := string(body)
31 32
 	for _, linePrefix := range stringsToCheck {
... ...
@@ -33,6 +33,7 @@ Here is a sample output:
33 33
     # docker info
34 34
     Containers: 14
35 35
     Images: 52
36
+    Engine Version: 1.9.0
36 37
     Storage Driver: aufs
37 38
      Root Dir: /var/lib/docker/aufs
38 39
      Dirs: 80