1、docker info 简介
docker info
是用于显示 Docker 系统的详细信息,包括 Docker 守护进程、容器数量、镜像数量、存储驱动程序、内核版本等。该命令可以帮助我们快速了解当前系统的 Docker 配置和状态。这个命令会显示系统范围内关于Docker安装的信息。显示的信息包括内核版本、容器数量和映像。显示的镜像数量是唯一镜像的数量。相同的镜像被标记为不同的名称只计算一次。如果指定了格式,则执行给定的模板,而不是默认格式。Go的text/template
包描述了该格式的所有细节。根据使用的存储驱动,可以显示额外的信息,如存储池名称、数据文件、元数据文件、已使用的数据空间、总数据空间、已使用的元数据空间和总元数据空间。数据文件是存储镜像的地方,元数据文件是存储这些镜像的元数据的地方。第一次运行时,Docker会从挂载/var/lib/docker
的卷上的可用空间中分配一定数量的数据空间和元数据空间。
2、docker info 语法
docker info [OPTIONS]
参考文档:https://docs.docker.com/engine/reference/commandline/info/
3、docker import 命令
1)显示输出
docker info Client: Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.10.4 Path: /usr/libexec/docker/cli-plugins/docker-buildx compose: Docker Compose (Docker Inc.) Version: v2.17.2 Path: /usr/libexec/docker/cli-plugins/docker-compose Server: Containers: 14 Running: 3 Paused: 1 Stopped: 10 Images: 52 Server Version: 23.0.3 Storage Driver: overlay2 Backing Filesystem: extfs Supports d_type: true Using metacopy: false Native Overlay Diff: true userxattr: false Logging Driver: json-file Cgroup Driver: systemd Cgroup Version: 2 Plugins: Volume: local Network: bridge host ipvlan macvlan null overlay Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog Swarm: inactive Runtimes: io.containerd.runc.v2 runc Default Runtime: runc Init Binary: docker-init containerd version: 2806fc1057397dbaeefbea0e4e17bddfbd388f38 runc version: v1.1.5-0-gf19387a init version: de40ad0 Security Options: apparmor seccomp Profile: builtin cgroupns Kernel Version: 5.15.0-25-generic Operating System: Ubuntu 22.04 LTS OSType: linux Architecture: x86_64 CPUs: 1 Total Memory: 991.7 MiB Name: ip-172-30-0-91.ec2.internal ID: 4cee4408-10d2-4e17-891c-a41736ac4536 Docker Root Dir: /var/lib/docker Debug Mode: false Username: gordontheturtle Registry: https://index.docker.io/v1/ Experimental: false Insecure Registries: myinsecurehost:5000 127.0.0.0/8 Live Restore Enabled: false
2)格式化输出 (--format)
docker info --format '{{json .}}' {"ID":"4cee4408-10d2-4e17-891c-a41736ac4536","Containers":14, ...}
3)在Windows上运行docker info
C:\> docker info Client: Context: default Debug Mode: false Plugins: buildx: Docker Buildx (Docker Inc.) Version: v0.10.4 Path: C:\Program Files\Docker\cli-plugins\docker-buildx.exe compose: Docker Compose (Docker Inc.) Version: v2.17.2 Path: C:\Program Files\Docker\cli-plugins\docker-compose.exe Server: Containers: 1 Running: 0 Paused: 0 Stopped: 1 Images: 17 Server Version: 23.0.3 Storage Driver: windowsfilter Logging Driver: json-file Plugins: Volume: local Network: ics internal l2bridge l2tunnel nat null overlay private transparent Log: awslogs etwlogs fluentd gcplogs gelf json-file local logentries splunk syslog Swarm: inactive Default Isolation: process Kernel Version: 10.0 20348 (20348.1.amd64fre.fe_release.210507-1500) Operating System: Microsoft Windows Server Version 21H2 (OS Build 20348.707) OSType: windows Architecture: x86_64 CPUs: 8 Total Memory: 3.999 GiB Name: WIN-V0V70C0LU5P ID: 2880d38d-464e-4d01-91bd-c76f33ba3981 Docker Root Dir: C:\ProgramData\docker Debug Mode: false Registry: https://index.docker.io/v1/ Experimental: true Insecure Registries: myregistry:5000 127.0.0.0/8 Registry Mirrors: http://192.168.1.2/http://registry-mirror.example.com:5000/ Live Restore Enabled: false
4)查看更详细的信息,可以使用 -v 参数
docker info -v
4、命令选项
简称 | 默认值 | 描述 |
--format , -f | 使用给定的Go模板格式化输出 |