1. docker version
1.1. 描述
docker version
命令输出 docker 的版本相关信息。
Docker 分为客户端 Client 和服务端 Server,在执行 docker 命令时是 docker 的 client 调用 server 端的 api 来执行操作。在使用 docker version 查看版本信息时,会同时提供客户端和服务端的版本相关信息。
1.2. 帮助
$ 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
1.3. 选项
选项 | 描述 |
---|---|
-f, --format string | 输出信息时指定格式 |
--kubeconfig string | 指定 kubernetes 的 kube config 文件 |
1.4. 示例:
- 显示当前 docker 的版本信息
# docker version
Client:
Version: 18.06.3-ce
API version: 1.38
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:26:51 2019
OS/Arch: linux/amd64
Experimental: false
Server:
Engine:
Version: 18.06.3-ce
API version: 1.38 (minimum version 1.12)
Go version: go1.10.3
Git commit: d7080c1
Built: Wed Feb 20 02:28:17 2019
OS/Arch: linux/amd64
Experimental: true
输出解释
参数 | 描述 |
---|---|
Client | 声明该部分是Docker客户端相关信息说明 |
Version: 18.06.3-ce | Docker客户端版本 |
API version: 1.38 | Docker客户端API版本 |
Go version: go1.10.3 | Docker客户端编译的Go版本 |
Git commit: d7080c1 | Docker客户端编译时Git Commit ID |
Built: Wed Feb 20 02:26:51 2019 | Docker客户端编译时间 |
OS/Arch: linux/amd64 | Docker客户端编译时的系统和架构 |
Experimental: false | Docker客户端是否开启试验性特性 |
Server | Docker的服务端相关的信息 |
Engine: | 服务端 Docker 引擎的信息 |
Version: 18.06.3-ce | Docker 服务端版本 |
API version: 1.38 (minimum version 1.12) | Docker 服务端api版本 |
Go version: go1.10.3 | Docker服务端编译时go版本 |
Git commit: d7080c1 | Docker服务端编译时代码Git Commit ID |
Built: Wed Feb 20 02:28:17 2019 | Docker服务端编译时间 |
OS/Arch: linux/amd64 | Docker服务端编译的系统和架构 |
Experimental: true | Docker服务端是否开启实验性特性 |
- 显示信息指定json格式
[root@ceph0 ~]# docker version --format '{{json .}}'
{"Client":{"Platform":{"Name":""},"Version":"18.06.3-ce","ApiVersion":"1.38","DefaultAPIVersion":"1.38","GitCommit":"d7080c1","GoVersion":"go1.10.3","Os":"linux","Arch":"amd64","BuildTime":"Wed Feb 20 02:26:51 2019","Experimental":false},"Server":{"Platform":{"Name":""},"Components":[{"Name":"Engine","Version":"18.06.3-ce","Details":{"ApiVersion":"1.38","Arch":"amd64","BuildTime":"Wed Feb 20 02:28:17 2019","Experimental":"true","GitCommit":"d7080c1","GoVersion":"go1.10.3","KernelVersion":"3.10.0-957.el7.x86_64","MinAPIVersion":"1.12","Os":"linux"}}],"Version":"18.06.3-ce","ApiVersion":"1.38","MinAPIVersion":"1.12","GitCommit":"d7080c1","GoVersion":"go1.10.3","Os":"linux","Arch":"amd64","KernelVersion":"3.10.0-957.el7.x86_64","Experimental":true,"BuildTime":"2019-02-20T02:28:17.000000000+00:00"}}