Merge pull request #15029 from azurezk/add-version-info

Add docker version info in /info request
This commit is contained in:
Alexandre Beslic 2015-09-21 11:44:11 -07:00
commit 40edb5f97c
8 changed files with 9 additions and 1 deletions

View File

@ -35,6 +35,7 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
fmt.Fprintf(cli.out, "Containers: %d\n", info.Containers) fmt.Fprintf(cli.out, "Containers: %d\n", info.Containers)
fmt.Fprintf(cli.out, "Images: %d\n", info.Images) fmt.Fprintf(cli.out, "Images: %d\n", info.Images)
fmt.Fprintf(cli.out, "Engine Version: %s\n", info.ServerVersion)
ioutils.FprintfIfNotEmpty(cli.out, "Storage Driver: %s\n", info.Driver) ioutils.FprintfIfNotEmpty(cli.out, "Storage Driver: %s\n", info.Driver)
if info.DriverStatus != nil { if info.DriverStatus != nil {
for _, pair := range info.DriverStatus { for _, pair := range info.DriverStatus {

View File

@ -215,6 +215,7 @@ type Info struct {
Name string Name string
Labels []string Labels []string
ExperimentalBuild bool ExperimentalBuild bool
ServerVersion string
} }
// ExecStartCheck is a temp struct used by execStart // ExecStartCheck is a temp struct used by execStart

View File

@ -90,6 +90,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
DockerRootDir: daemon.config().Root, DockerRootDir: daemon.config().Root,
Labels: daemon.config().Labels, Labels: daemon.config().Labels,
ExperimentalBuild: utils.ExperimentalBuild(), ExperimentalBuild: utils.ExperimentalBuild(),
ServerVersion: dockerversion.VERSION,
} }
// TODO Windows. Refactor this more once sysinfo is refactored into // TODO Windows. Refactor this more once sysinfo is refactored into

View File

@ -88,6 +88,7 @@ This section lists each version from latest to oldest. Each listing includes a
list of DNS options to be used in the container. list of DNS options to be used in the container.
* `POST /build` now optionally takes a serialized map of build-time variables. * `POST /build` now optionally takes a serialized map of build-time variables.
* `GET /events` now includes a `timenano` field, in addition to the existing `time` field. * `GET /events` now includes a `timenano` field, in addition to the existing `time` field.
* `GET /info` now lists engine version information.
### v1.20 API changes ### v1.20 API changes

View File

@ -1860,6 +1860,7 @@ Display system-wide information
}, },
"SwapLimit": false, "SwapLimit": false,
"SystemTime": "2015-03-10T11:11:23.730591467-07:00" "SystemTime": "2015-03-10T11:11:23.730591467-07:00"
"ServerVersion": "1.9.0"
} }
Status Codes: Status Codes:

View File

@ -21,6 +21,7 @@ For example:
$ docker -D info $ docker -D info
Containers: 14 Containers: 14
Images: 52 Images: 52
Engine Version: 1.9.0
Storage Driver: aufs Storage Driver: aufs
Root Dir: /var/lib/docker/aufs Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs Backing Filesystem: extfs

View File

@ -25,7 +25,8 @@ func (s *DockerSuite) TestInfoApi(c *check.C) {
"NCPU", "NCPU",
"MemTotal", "MemTotal",
"KernelVersion", "KernelVersion",
"Driver"} "Driver",
"ServerVersion"}
out := string(body) out := string(body)
for _, linePrefix := range stringsToCheck { for _, linePrefix := range stringsToCheck {

View File

@ -33,6 +33,7 @@ Here is a sample output:
# docker info # docker info
Containers: 14 Containers: 14
Images: 52 Images: 52
Engine Version: 1.9.0
Storage Driver: aufs Storage Driver: aufs
Root Dir: /var/lib/docker/aufs Root Dir: /var/lib/docker/aufs
Dirs: 80 Dirs: 80