docker info:显示 Docker 系统的详细信息,包括 Docker 版本、存储驱动、镜像数量、容器数量以及其他重要的配置信息。
bash
[root@rocky8 ~]#docker info
Client: Docker Engine - Community
Version: 29.8.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.37.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v5.5.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 29.8.1
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: cgroupfs
Cgroup Version: 1
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
CDI spec directories:
/etc/cdi
/var/run/cdi
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 1294c24a7da8e5a793ed378161673abe94118892
runc version: v1.5.1-0-g8f2685a4
init version: de40ad0
Security Options:
seccomp
Profile: builtin
Kernel Version: 4.18.0-553.148.1.el8_10.x86_64
Operating System: Rocky Linux 8.10 (Green Obsidian)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.893GiB
Name: rocky8
ID: 84f63171-a0e1-4b92-a7c4-ac9a3a951d18
Docker Root Dir: /data/docker
Debug Mode: false
Experimental: false
Insecure Registries:
::1/128
127.0.0.0/8
Registry Mirrors:
https://docker.1ms.run/
https://docker.m.daocloud.io/
https://mirrors.ustc.edu.cn/
Live Restore Enabled: true
Firewall Backend: iptables
WARNING: Support for cgroup v1 is deprecated and planned to be removed by no later than May 2029 (https://github.com/moby/moby/issues/51111)
一、客户端部分(Client)
| 项目 | 值 | 说明 |
|---|---|---|
| Version | 29.8.1 | Docker CLI 版本 |
| Context | default | 默认上下文,default = 本地 dockerd |
| Debug Mode | false | 未开启调试 |
| buildx | v0.37.1 | 多平台构建插件(arm64/amd64 交叉编译) |
| compose | v5.5.1 | 编排插件(新版独立CLI) |
二、服务端部分(Server)
2.1容器与镜像状态
bash
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 29.8.1
当前是全新环境,没有任何容器或镜像。服务端跟客户端版本一致
2.2存储驱动(Storage Driver)
html
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
| 项目 | 含义 | 评价 |
|---|---|---|
| overlay2 | Docker 推荐的存储驱动 | ✅ 正确 |
| xfs | 后端文件系统 | ✅ 与 Rocky 8 默认一致 |
| d_type: true | 支持目录类型检测 | ✅ 性能好 |
| metacopy: false | 未启用元数据拷贝优化 | ⚠️ 可选开启 |
| Native Overlay Diff: true | 支持原生层差异 | ✅ 好 |
| userxattr: false | 不支持扩展属性 | ⚠️ 某些场景可能需要 |
2.3 日志驱动(Logging Driver)
html
Logging Driver: json-file
默认,Docker 容器日志用 json-file 驱动来存,docker logs 能看
**建议配置(写入 /etc/docker/daemon.json)**:
bash
[root@rocky8 ~]#vim /etc/docker/daemon.json
{
"log-driver": "json-file",
"log-opts": {
"max-size": "100m",
"max-file": "3"
}
}
#每个容器日志最多 100MB × 3 个文件 = 300MB 上限,防止磁盘撑爆。
2.31重启验证
bash
[root@rocky8 ~]#systemctl daemon-reload
[root@rocky8 ~]#systemctl restart docker.service
2.4Cgroup 驱动(Cgroup Driver)
html
Cgroup Driver: cgroupfs
Cgroup Version: 1
官方警告:
Support for cgroup v1 is deprecated and planned to be removed by no later than May 2029
| 项目 | 说明 |
|---|---|
| cgroup v1 | cgroup v1(Rocky 8 默认) |
| 警告含义 | cgroup v1 将在 2029 年 5 月前从 Docker 移除 |
| 影响 | 现在没事,Rocky 9 默认用 cgroup v2 |
| 要不要改 | 现在不用管,还有 3 年,而且 Rocky 8 不支持 cgroup v2 |
| 选项 | 说明 |
|---|---|
| cgroupfs | Docker 自己管 cgroup(当前) |
| systemd | 委托 systemd 管(K8s 推荐) |
单机 Docker 用
cgroupfs没问题。如果后面上 K8s,需要改成systemd。
2.5网络插件
html
Network: bridge host ipvlan macvlan null overlay
标准网络模式齐全
| 驱动 | 用途 |
|---|---|
| bridge | 默认,容器间通信 |
| host | 共享宿主机网络 |
| overlay | 跨主机容器网络(Swarm/K8s) |
| macvlan | 给容器分配 MAC 地址 |
| ipvlan | 类似 macvlan 但轻量 |
| null | 无网络 |
2.6容器运行时(Runtimes)
html
Runtimes: io.containerd.runc.v2 runc
Default Runtime: runc
containerd version: 1294c24a7da8e5a793ed378161673abe94118892
runc version: v1.5.1-0-g8f2685a4
组件正常,containerd + runc 是标准组合。
2.7安全选项
html
Security Options:
seccomp
Profile: builtin
| 项目 | 含义 |
|---|---|
| seccomp | 系统调用过滤,限制容器能调的内核 API |
| builtin | 用 Docker 内置默认 profile |
2.8系统信息
html
Kernel Version: 4.18.0-553.148.1.el8_10.x86_64
Operating System: Rocky Linux 8.10 (Green Obsidian)
OSType: linux
Architecture: x86_64
CPUs: 2
Total Memory: 1.893GiB
| 项目 | 值 | 评价 |
|---|---|---|
| 内核 | 4.18.0-553.148.1 | ✅ 最新 Rocky 8 内核 |
| OS | Rocky 8.10 | ✅ 当前最新小版本 |
| CPU | 2 核 | 够跑 Docker + 几个容器,偏少,生产环境建议 4+ 核 |
| 内存 | 1.893GiB(约 1.9GB) | ⚠️ 偏少,Docker + 应用容易 OOM |
2.9Docker 根目录
html
Docker Root Dir: /data/docker
将数据目录放在 /data 分区而非根目录 /var/lib/docker,避免根分区被日志/镜像撑满。
2.10镜像加速(Registry Mirrors)
html
Registry Mirrors:
https://docker.1ms.run/
https://docker.m.daocloud.io/
https://mirrors.ustc.edu.cn/
配置三个国内镜像源,拉取镜像速度会快很多
2.11Live Restore(热重启)
html
Live Restore Enabled: true
Docker 服务重启时容器不停止,比如 systemctl restart docker,容器继续跑,提高可用性
2.12防火墙后端
html
Firewall Backend: iptables
Docker 用 iptables 做端口映射和网络隔离
2.13不安全的镜像仓库
html
Insecure Registries:
::1/128
127.0.0.0/8
允许本地回环地址使用 HTTP(非 HTTPS)拉取镜像,这是标准配置。
2.14Swarm
html
Swarm: inactive
没开 Swarm 集群模式,单机用没问题。