
Docker System 相关命令说明:
命令 | 描述 |
|---|---|
docker system df | 显示 docker 磁盘使用情况 |
docker system events | 获取 server 实时实践 |
docker system info | 显示系统范围的信息 |
docker system prune | 删除无用数据 |
这个命令显示 docker daemon 磁盘空间的使用情况。示例:
$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 3 1 456.6MB 361.7MB (79%)
Containers 1 1 0B 0B
Local Volumes 1 1 0B 0B
Build Cache 0 0 0B 0B查看详情,使用加上 -v 标识:
$ docker system df -v
Images space usage:
REPOSITORY TAG IMAGE ID CREATED ago SIZE SHARED SIZE UNIQUE SiZE CONTAINERS
redis latest 1babb1dde7e1 10 days ago ago 94.91MB 0B 94.91MB 1
redis 4.0.9 bfcb1f6df2db 6 months ago ago 106.7MB 0B 106.7MB 0
registry.cn-hangzhou.aliyuncs.com/anoy/ubuntu latest e72898b400f8 15 months ago ago 254.9MB 0B 254.9MB 0
Containers space usage:
CONTAINER ID IMAGE COMMAND LOCAL VOLUMES SIZE CREATED ago STATUS NAMES
b67d3fff0ccc redis "docker-entrypoint.s…" 1 0B About a minute ago ago Up About a minute compassionate_leakey
Local Volumes space usage:
VOLUME NAME LINKS SIZE
9efe55b2bef5d96d6584f2fe6a81834368a4a82faf0ba248e1b63e10f3c5a2a3 1 0B
Build cache usage: 0B相关参数说明:
SHARED SIZE 表示一个镜像和其他镜像共享的空间量UNIQUE SiZE 表示该镜像独有的空间量SIZE 表示 [shared size] + [unique size]这个命令获取 server 端的实时事件,这些事件因 docker 对象类型而异。
对象类型:containers
对象类型:images
对象类型:plugins
对象类型:volumes
对象类型:networks
对象类型:daemons
可选参数:
名称, 短名称 | 描述 |
|---|---|
--filter , -f | 根据条件过滤输出 |
--since | 起始时间戳,只显示该时间后的事件 |
--until | 截止时间戳,只显示该时间前的事件 |
打开两个终端窗口,示例:

目前支持的过滤条件如下:
container=<name or id>)daemon=<name or id>)event=<event action>)image=<tag or id>)label=<key> or label=<key>=<value>)network=<name or id>)plugin=<name or id>)type=<container or image or volume or network or daemon or plugin>)volume=<name or id>)打开两个终端窗口,示例:

显示系统范围的信息,与 docker info 输出结果一致
删除所有未使用的容器、网络、镜像以及数据卷。
基本命令,示例 docker system prune:
$ docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all build cache
Are you sure you want to continue? [y/N] y
Total reclaimed space: 0B提示:dangling images 表示
docker images标签为<none>的镜像
基本命令,示例 docker system prune -a:
$ docker system prune -a
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all images without at least one container associated to them
- all build cache
Are you sure you want to continue? [y/N] y提示:
-a会额外删除没有容器使用的镜像
删除数据卷,示例 docker system prune -a --volumes:
$ docker system prune -a --volumes
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all volumes not used by at least one container
- all images without at least one container associated to them
- all build cache
Are you sure you want to continue? [y/N] y提示:
--volumes会额外删除没有容器使用的数据卷