add --format flag to docker version

Signed-off-by: Patrick Hemmer <patrick.hemmer@gmail.com>
This commit is contained in:
Patrick Hemmer
2017-06-02 00:07:01 +00:00
committed by Tibor Vass
parent 23256b7438
commit 90f2c9cf90
2 changed files with 45 additions and 5 deletions
+22 -2
View File
@@ -6,19 +6,25 @@ docker-version - Show the Docker version information.
# SYNOPSIS
**docker version**
[**--help**]
[**-f**|**--format**[=*FORMAT*]]
# DESCRIPTION
This command displays version information for both the Docker client and
daemon.
# OPTIONS
There are no available options.
**--help**
Print usage statement
**-f**, **--format**=""
Format the output using the given go template.
# EXAMPLES
## Display Docker version information
Here is a sample output:
The default output:
$ docker version
Client:
@@ -36,7 +42,21 @@ Here is a sample output:
Git commit: f5bae0a
Built: Tue Jun 23 17:56:00 UTC 2015
OS/Arch: linux/amd64
Get server version:
$ docker version --format '{{.Server.Version}}'
1.8.0
Dump raw data:
To view all available fields, you can use the format `{{json .}}`.
$ docker version --format '{{json .}}'
{"Client":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"},"ServerOK":true,"Server":{"Version":"1.8.0","ApiVersion":"1.20","GitCommit":"f5bae0a","GoVersion":"go1.4.2","Os":"linux","Arch":"amd64","KernelVersion":"3.13.2-gentoo","BuildTime":"Tue Jun 23 17:56:00 UTC 2015"}}
# HISTORY
June 2014, updated by Sven Dowideit <SvenDowideit@home.org.au>
June 2015, updated by John Howard <jhoward@microsoft.com>
June 2015, updated by Patrick Hemmer <patrick.hemmer@gmail.com