EN
Docker check version
4
points
Hi, today I would like to show you how to check docker version from command line.
Quick solution:
$ docker -v
Practical example:
[root@localhost]# docker -v
Docker version 19.03.13, build 4484c46d9d
Docker version with all details
In order to see all details of docker version, we can use below commnad:
$ docker version
Practical example:
[root@localhost]# docker version
Client: Docker Engine - Community
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:03:45 2020
OS/Arch: linux/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.13
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:02:21 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.3.7
GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Docker print only server version
Sometimes we just need to get only docker version:
$ 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:
[root@localhost]# docker version --format '{{.Server.Version}}'
19.03.13
Docker version print JSON
To show docker version in JSON format we can use:
$ docker version --format '{{json .}}'
Practical example:
[root@localhost]# docker version --format '{{json .}}'
{"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:
$ docker version --format '{{json .}}' | python -m json.tool
Docker version in json - pretty formatted:
[root@localhost]# docker version --format '{{json .}}' | python -m json.tool
{
"Client": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "Wed Sep 16 17:03:45 2020",
"DefaultAPIVersion": "1.40",
"Experimental": false,
"GitCommit": "4484c46d9d",
"GoVersion": "go1.13.15",
"Os": "linux",
"Platform": {
"Name": "Docker Engine - Community"
},
"Version": "19.03.13"
},
"Server": {
"ApiVersion": "1.40",
"Arch": "amd64",
"BuildTime": "2020-09-16T17:02:21.000000000+00:00",
"Components": [
{
"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": "Engine",
"Version": "19.03.13"
},
{
"Details": {
"GitCommit": "8fba4e9a7d01810a393d5d25a3621dc101981175"
},
"Name": "containerd",
"Version": "1.3.7"
},
{
"Details": {
"GitCommit": "dc9208a3303feef5b3839f4323d9beb36df0a9dd"
},
"Name": "runc",
"Version": "1.0.0-rc10"
},
{
"Details": {
"GitCommit": "fec3683"
},
"Name": "docker-init",
"Version": "0.18.0"
}
],
"GitCommit": "4484c46d9d",
"GoVersion": "go1.13.15",
"KernelVersion": "3.10.0-693.el7.x86_64",
"MinAPIVersion": "1.12",
"Os": "linux",
"Platform": {
"Name": "Docker Engine - Community"
},
"Version": "19.03.13"
}
}
Docker version print help
If we want to print help for docker version:
$ docker version --help
Practical example:
[root@localhost]# docker version --help
Usage: docker version [OPTIONS]
Show the Docker version information
Options:
-f, --format string Format the output using the given Go template
--kubeconfig string Kubernetes config file