@@ -19,38 +19,91 @@ Options:
1919
2020## Description
2121
22- By default, this will render all version information in an easy to read
23- layout. If a format is specified, the given template will be executed instead.
22+ The version command prints the current version number for all independently
23+ versioned Docker components. Use the [ ` --format ` ] ( #format ) option to customize
24+ the output.
2425
25- Go's [ text/template] ( https://golang.org/pkg/text/template/ ) package
26- describes all the details of the format.
27-
28- ## Examples
26+ The version command (` docker version ` ) outputs the version numbers of Docker
27+ components, while the ` --version ` flag (` docker --version ` ) outputs the version
28+ number of the Docker CLI you are using.
2929
3030### Default output
3131
32+ The default output renders all version information divided into two sections;
33+ the "Client" section contains information about the Docker CLI and client
34+ components, and the "Server" section contains information about the Docker
35+ Engine and components used by the Engine, such as the "Containerd" and "Runc"
36+ OCI Runtimes.
37+
38+ The information shown may differ depending on how you installed Docker and
39+ what components are in use. The following example shows the output on a macOS
40+ machine running Docker Desktop:
41+
3242``` console
3343$ docker version
3444
3545Client:
36- Version: 19.03.8
37- API version: 1.40
38- Go version: go1.12.17
39- Git commit: afacb8b
40- Built: Wed Mar 11 01:21:11 2020
46+ Version: 20.10.16
47+ API version: 1.41
48+ Go version: go1.17.10
49+ Git commit: aa7e414
50+ Built: Thu May 12 09:17:28 2022
4151 OS/Arch: darwin/amd64
4252 Context: default
43- Experimental: true
4453
45- Server:
54+ Server: Docker Desktop 4.8.2 (77141)
55+ Engine:
56+ Version: 20.10.16
57+ API version: 1.41 (minimum version 1.12)
58+ Go version: go1.17.10
59+ Git commit: f756502
60+ Built: Thu May 12 09:15:33 2022
61+ OS/Arch: linux/amd64
62+ Experimental: false
63+ containerd:
64+ Version: 1.6.4
65+ GitCommit: 212e8b6fa2f44b9c21b2798135fc6fb7c53efc16
66+ runc:
67+ Version: 1.1.1
68+ GitCommit: v1.1.1-0-g52de29d
69+ docker-init:
70+ Version: 0.19.0
71+ GitCommit: de40ad0
72+ ```
73+
74+ ### Client and server versions
75+
76+ Docker uses a client/server architecture, which allows you to use the Docker CLI
77+ on your local machine to control a Docker Engine running on a remote machine,
78+ which can be (for example) a machine running in the Cloud or inside a Virtual Machine.
79+
80+ The following example switches the Docker CLI to use a [ context] ( context.md )
81+ named "remote-test-server", which runs an older version of the Docker Engine
82+ on a Linux server:
83+
84+ ``` console
85+ $ docker context use remote-test-server
86+ remote-test-server
87+
88+ $ docker version
89+
90+ Client:
91+ Version: 20.10.16
92+ API version: 1.40 (downgraded from 1.41)
93+ Go version: go1.17.10
94+ Git commit: aa7e414
95+ Built: Thu May 12 09:17:28 2022
96+ OS/Arch: darwin/amd64
97+ Context: remote-test-server
98+
99+ Server: Docker Engine - Community
46100 Engine:
47101 Version: 19.03.8
48102 API version: 1.40 (minimum version 1.12)
49103 Go version: go1.12.17
50104 Git commit: afacb8b
51105 Built: Wed Mar 11 01:29:16 2020
52106 OS/Arch: linux/amd64
53- Experimental: true
54107 containerd:
55108 Version: v1.2.13
56109 GitCommit: 7ad184331fa3e55e52b890ea95e65ba581ae3429
@@ -62,12 +115,21 @@ Server:
62115 GitCommit: fec3683
63116```
64117
118+ ## Examples
119+
120+ ### <a name =format ></a > Format the output (--format)
121+
122+ The formatting option (` --format ` ) pretty-prints the output using a Go template,
123+ which allows you to customize the output format, or to obtain specific information
124+ from the output. Refer to the [ format command and log output] ( https://docs.docker.com/config/formatting/ )
125+ page for details of the format.
126+
65127### Get the server version
66128
67129``` console
68130$ docker version --format ' {{.Server.Version}}'
69131
70- 19.03.8
132+ 20.10.16
71133```
72134
73135### Dump raw JSON data
0 commit comments