docker system 其中最重要的一个命令就是docker system prune 命令,清理没有使用的数据,包括镜像数据,已经停止的容器
查看 docker system 帮助
[root@localhost ~]# docker system --help
Usage: docker system COMMAND
Manage Docker
Options:
--help Print usage
Commands:
df Show docker disk usage
events Get real time events from the server
info Display system-wide information
prune Remove unused data
Run 'docker system COMMAND --help' for more information on a command.
[root@localhost ~]#
docker system prune
[root@localhost ~]# 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
[root@localhost ~]#
docker system df
查看容器磁盘使用情况
[root@localhost ~]# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 10 6 2.652GB 1.953GB (73%)
Containers 6 6 6.922MB 0B (0%)
Local Volumes 0 0 0B 0B
[root@localhost ~]#
docker systemc info (docker info)
[root@localhost ~]# docker system info
Containers: 6
Running: 6
Paused: 0
Stopped: 0
Images: 49
Server Version: 17.06.2-ce
Storage Driver: overlay
Backing Filesystem: xfs
Supports d_type: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 6e23458c129b551d5c9871e5174f6b1b7f6d1170
runc version: 810190ceaa507aa2727d7ae6f4790c76ec150bd2
init version: 949e6fa
Security Options:
seccomp
Profile: default
Kernel Version: 3.10.0-514.26.2.el7.x86_64
Operating System: CentOS Linux 7 (Core)
OSType: linux
Architecture: x86_64
CPUs: 24
Total Memory: 31.21GiB
Name: localhost.localdomain
ID: YTL2:6RWX:IZK6:X4XC:XKMO:WVXD:LXPR:E5GN:GEJB:WIUX:L5YH:PDFB
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): false
Registry: https://index.docker.io/v1/
Experimental: false
Insecure Registries:
127.0.0.0/8
Registry Mirrors:
http://9zkjjecg.mirror.aliyuncs.com/
https://docker.mirrors.ustc.edu.cn/
Live Restore Enabled: false
[root@localhost ~]#