Browse code

Merge pull request #27992 from Microsoft/jjh/minapitoinfo

Adds `MinAPIVersion` to docker version

Victor Vieux authored on 2016/11/09 08:49:33
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"
... ...
@@ -167,13 +168,14 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
167 167
 // SystemVersion returns version information about the daemon.
168 168
 func (daemon *Daemon) SystemVersion() types.Version {
169 169
 	v := types.Version{
170
-		Version:      dockerversion.Version,
171
-		GitCommit:    dockerversion.GitCommit,
172
-		GoVersion:    runtime.Version(),
173
-		Os:           runtime.GOOS,
174
-		Arch:         runtime.GOARCH,
175
-		BuildTime:    dockerversion.BuildTime,
176
-		Experimental: daemon.configStore.Experimental,
170
+		Version:       dockerversion.Version,
171
+		GitCommit:     dockerversion.GitCommit,
172
+		MinAPIVersion: api.MinVersion,
173
+		GoVersion:     runtime.Version(),
174
+		Os:            runtime.GOOS,
175
+		Arch:          runtime.GOARCH,
176
+		BuildTime:     dockerversion.BuildTime,
177
+		Experimental:  daemon.configStore.Experimental,
177 178
 	}
178 179
 
179 180
 	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`.
... ...
@@ -2768,6 +2768,7 @@ Show the docker version information
2768 2768
          "GitCommit": "deadbee",
2769 2769
          "Arch": "amd64",
2770 2770
          "ApiVersion": "1.25",
2771
+         "MinAPIVersion": "1.12",
2771 2772
          "BuildTime": "2016-06-14T07:09:13.444803460+00:00",
2772 2773
          "Experimental": true
2773 2774
     }
... ...
@@ -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)))