EN
Docker check version
4 points
Hi, today I would like to show you how to check docker version from command line.
Quick solution:
xxxxxxxxxx
1
$ docker -v
Practical example:
xxxxxxxxxx
1
[root@localhost]# docker -v
2
Docker version 19.03.13, build 4484c46d9d
In order to see all details of docker version, we can use below commnad:
xxxxxxxxxx
1
$ docker version
Practical example:
xxxxxxxxxx
1
[root@localhost]# docker version
2
Client: Docker Engine - Community
3
Version: 19.03.13
4
API version: 1.40
5
Go version: go1.13.15
6
Git commit: 4484c46d9d
7
Built: Wed Sep 16 17:03:45 2020
8
OS/Arch: linux/amd64
9
Experimental: false
10
11
Server: Docker Engine - Community
12
Engine:
13
Version: 19.03.13
14
API version: 1.40 (minimum version 1.12)
15
Go version: go1.13.15
16
Git commit: 4484c46d9d
17
Built: Wed Sep 16 17:02:21 2020
18
OS/Arch: linux/amd64
19
Experimental: false
20
containerd:
21
Version: 1.3.7
22
GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175
23
runc:
24
Version: 1.0.0-rc10
25
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
26
docker-init:
27
Version: 0.18.0
28
GitCommit: fec3683
Sometimes we just need to get only docker version:
xxxxxxxxxx
1
$ docker version --format '{{.Server.Version}}'
It is useful when we create some automation and we need to ensure docker version is above some version.
Practical example:
xxxxxxxxxx
1
[root@localhost]# docker version --format '{{.Server.Version}}'
2
19.03.13
To show docker version in JSON format we can use:
xxxxxxxxxx
1
$ docker version --format '{{json .}}'
Practical example:
xxxxxxxxxx
1
[root@localhost]# docker version --format '{{json .}}'
2
{"Client":{"Platform":{"Name":"Docker Engine - Community"},"Version":"19.03.13","ApiVersion":"1.40","DefaultAPIVersion":"1.40","GitCommit":"4484c46d9d","GoVersion":"go1.13.15","Os":"linux","Arch":"amd64","BuildTime":"Wed Sep 16 17:03:45 2020","Experimental":false},"Server":{"Platform":{"Name":"Docker Engine - Community"},"Components":[{"Name":"Engine","Version":"19.03.13","Details":{"ApiVersion":"1.40","Arch":"amd64","BuildTime":"Wed Sep 16 17:02:21 2020","Experimental":"false","GitCommit":"4484c46d9d","GoVersion":"go1.13.15","KernelVersion":"3.10.0-693.el7.x86_64","MinAPIVersion":"1.12","Os":"linux"}},{"Name":"containerd","Version":"1.3.7","Details":{"GitCommit":"8fba4e9a7d01810a393d5d25a3621dc101981175"}},{"Name":"runc","Version":"1.0.0-rc10","Details":{"GitCommit":"dc9208a3303feef5b3839f4323d9beb36df0a9dd"}},{"Name":"docker-init","Version":"0.18.0","Details":{"GitCommit":"fec3683"}}],"Version":"19.03.13","ApiVersion":"1.40","MinAPIVersion":"1.12","GitCommit":"4484c46d9d","GoVersion":"go1.13.15","Os":"linux","Arch":"amd64","KernelVersion":"3.10.0-693.el7.x86_64","BuildTime":"2020-09-16T17:02:21.000000000+00:00"}}
If we want to print docker version json pretty formatted we can use python -m json.tool
, command:
xxxxxxxxxx
1
$ docker version --format '{{json .}}' | python -m json.tool
Docker version in json - pretty formatted:
xxxxxxxxxx
1
[root@localhost]# docker version --format '{{json .}}' | python -m json.tool
2
{
3
"Client": {
4
"ApiVersion": "1.40",
5
"Arch": "amd64",
6
"BuildTime": "Wed Sep 16 17:03:45 2020",
7
"DefaultAPIVersion": "1.40",
8
"Experimental": false,
9
"GitCommit": "4484c46d9d",
10
"GoVersion": "go1.13.15",
11
"Os": "linux",
12
"Platform": {
13
"Name": "Docker Engine - Community"
14
},
15
"Version": "19.03.13"
16
},
17
"Server": {
18
"ApiVersion": "1.40",
19
"Arch": "amd64",
20
"BuildTime": "2020-09-16T17:02:21.000000000+00:00",
21
"Components": [
22
{
23
"Details": {
24
"ApiVersion": "1.40",
25
"Arch": "amd64",
26
"BuildTime": "Wed Sep 16 17:02:21 2020",
27
"Experimental": "false",
28
"GitCommit": "4484c46d9d",
29
"GoVersion": "go1.13.15",
30
"KernelVersion": "3.10.0-693.el7.x86_64",
31
"MinAPIVersion": "1.12",
32
"Os": "linux"
33
},
34
"Name": "Engine",
35
"Version": "19.03.13"
36
},
37
{
38
"Details": {
39
"GitCommit": "8fba4e9a7d01810a393d5d25a3621dc101981175"
40
},
41
"Name": "containerd",
42
"Version": "1.3.7"
43
},
44
{
45
"Details": {
46
"GitCommit": "dc9208a3303feef5b3839f4323d9beb36df0a9dd"
47
},
48
"Name": "runc",
49
"Version": "1.0.0-rc10"
50
},
51
{
52
"Details": {
53
"GitCommit": "fec3683"
54
},
55
"Name": "docker-init",
56
"Version": "0.18.0"
57
}
58
],
59
"GitCommit": "4484c46d9d",
60
"GoVersion": "go1.13.15",
61
"KernelVersion": "3.10.0-693.el7.x86_64",
62
"MinAPIVersion": "1.12",
63
"Os": "linux",
64
"Platform": {
65
"Name": "Docker Engine - Community"
66
},
67
"Version": "19.03.13"
68
}
69
}
If we want to print help for docker version:
xxxxxxxxxx
1
$ docker version --help
Practical example:
xxxxxxxxxx
1
[root@localhost]# docker version --help
2
3
Usage: docker version [OPTIONS]
4
5
Show the Docker version information
6
7
Options:
8
-f, --format string Format the output using the given Go template
9
--kubeconfig string Kubernetes config file