Browse code

Adds minimum API version to version

Signed-off-by: John Howard <jhoward@microsoft.com>

John Howard authored on 2016/11/03 02:04:39
Showing 6 changed files
... ...
@@ -133,6 +133,7 @@ type ContainerProcessList struct {
133 133
 type Version struct {
134 134
 	Version       string
135 135
 	APIVersion    string `json:"ApiVersion"`
136
+	MinAPIVersion string `json:"MinAPIVersion,omitempty"`
136 137
 	GitCommit     string
137 138
 	GoVersion     string
138 139
 	Os            string
... ...
@@ -23,13 +23,14 @@ var versionTemplate = `Client:
23 23
  OS/Arch:      {{.Client.Os}}/{{.Client.Arch}}{{if .ServerOK}}
24 24
 
25 25
 Server:
26
- Version:      {{.Server.Version}}
27
- API version:  {{.Server.APIVersion}}
28
- Go version:   {{.Server.GoVersion}}
29
- Git commit:   {{.Server.GitCommit}}
30
- Built:        {{.Server.BuildTime}}
31
- OS/Arch:      {{.Server.Os}}/{{.Server.Arch}}
32
- Experimental: {{.Server.Experimental}}{{end}}`
26
+ Version:             {{.Server.Version}}
27
+ API version:         {{.Server.APIVersion}}
28
+ Minimum API version: {{.Server.MinAPIVersion}}
29
+ Go version:          {{.Server.GoVersion}}
30
+ Git commit:          {{.Server.GitCommit}}
31
+ Built:               {{.Server.BuildTime}}
32
+ OS/Arch:             {{.Server.Os}}/{{.Server.Arch}}
33
+ Experimental:        {{.Server.Experimental}}{{end}}`
33 34
 
34 35
 type versionOptions struct {
35 36
 	format string
... ...
@@ -7,6 +7,7 @@ import (
7 7
 	"time"
8 8
 
9 9
 	"github.com/Sirupsen/logrus"
10
+	"github.com/docker/docker/api"
10 11
 	"github.com/docker/docker/api/types"
11 12
 	"github.com/docker/docker/container"
12 13
 	"github.com/docker/docker/dockerversion"
... ...
@@ -156,13 +157,14 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
156 156
 // SystemVersion returns version information about the daemon.
157 157
 func (daemon *Daemon) SystemVersion() types.Version {
158 158
 	v := types.Version{
159
-		Version:      dockerversion.Version,
160
-		GitCommit:    dockerversion.GitCommit,
161
-		GoVersion:    runtime.Version(),
162
-		Os:           runtime.GOOS,
163
-		Arch:         runtime.GOARCH,
164
-		BuildTime:    dockerversion.BuildTime,
165
-		Experimental: daemon.configStore.Experimental,
159
+		Version:       dockerversion.Version,
160
+		GitCommit:     dockerversion.GitCommit,
161
+		MinAPIVersion: api.MinVersion,
162
+		GoVersion:     runtime.Version(),
163
+		Os:            runtime.GOOS,
164
+		Arch:          runtime.GOARCH,
165
+		BuildTime:     dockerversion.BuildTime,
166
+		Experimental:  daemon.configStore.Experimental,
166 167
 	}
167 168
 
168 169
 	kernelVersion := "<unknown>"
... ...
@@ -130,6 +130,7 @@ This section lists each version from latest to oldest.  Each listing includes a
130 130
 
131 131
 [Docker Remote API v1.25](docker_remote_api_v1.25.md) documentation
132 132
 
133
+* `GET /version` now returns `MinAPIVersion`.
133 134
 * `POST /build` accepts `networkmode` parameter to specify network used during build.
134 135
 * `GET /images/(name)/json` now returns `OsVersion` if populated
135 136
 * `GET /info` now returns `Isolation`.
... ...
@@ -2741,6 +2741,7 @@ Show the docker version information
2741 2741
          "GitCommit": "deadbee",
2742 2742
          "Arch": "amd64",
2743 2743
          "ApiVersion": "1.25",
2744
+         "MinAPIVersion": "1.12",
2744 2745
          "BuildTime": "2016-06-14T07:09:13.444803460+00:00",
2745 2746
          "Experimental": true
2746 2747
     }
... ...
@@ -14,7 +14,7 @@ func (s *DockerSuite) TestVersionEnsureSucceeds(c *check.C) {
14 14
 		"Client:":       1,
15 15
 		"Server:":       1,
16 16
 		" Version:":     2,
17
-		" API version:": 2,
17
+		" API version:": 3,
18 18
 		" Go version:":  2,
19 19
 		" Git commit:":  2,
20 20
 		" OS/Arch:":     2,
... ...
@@ -40,7 +40,7 @@ func (s *DockerSuite) TestVersionPlatform_l(c *check.C) {
40 40
 
41 41
 func testVersionPlatform(c *check.C, platform string) {
42 42
 	out, _ := dockerCmd(c, "version")
43
-	expected := "OS/Arch:      " + platform
43
+	expected := "OS/Arch:             " + platform
44 44
 
45 45
 	split := strings.Split(out, "\n")
46 46
 	c.Assert(len(split) >= 14, checker.Equals, true, check.Commentf("got %d lines from version", len(split)))