[root@youtmd /]# du -h -d 1 261M ./root 52K ./tmp 0 ./dev 16K ./lost+found 108K ./log 5.0G ./www 4.0K ./media 0 ./sys 24K ./home 27M ./etc 4.0K ./data 89M ./run du: cannot access './proc/1220704/task/1220704/fd/4': No such file or directory du: cannot access './proc/1220704/task/1220704/fdinfo/4': No such file or directory du: cannot access './proc/1220704/fd/3': No such file or directory du: cannot access './proc/1220704/fdinfo/3': No such file or directory 0 ./proc 303M ./boot 22G ./var 3.3G ./usr 4.0K ./mnt 4.2M ./opt 4.0K ./srv 30G .
可以看出上面的/var文件夹占空间较大,可我没有存放什么文件到该文件夹。
后来想了一下,有可能是docker。
Docker占空间的无非是:
镜像
容器
构建过程产生的构建日志Build Cache
Docker镜像:
1 2 3 4 5 6 7 8 9
[root@youtmd /]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE www-myblog latest 0307164d754b 25 hours ago 336MB myblog latest 17b3ffd5631d 4 days ago 329MB depoly-phpfpm latest 29847cdc4641 2 months ago 511MB nginx latest eea7b3dcba7e 2 months ago 187MB ghcr.io/getzola/zola v0.17.2 a37168718925 7 months ago 47.4MB ghcr.io/getzola/zola v0.17.1 364fea1e8204 7 months ago 47.3MB ghcr.io/getzola/zola v0.15.1 8bc5561f3d57 22 months ago 50.6MB
单凭查看,可以看到docker镜像也不占太大空间。
但是用docker system df命令查看后:
1 2 3 4 5 6
[root@youtmd var]# docker system df TYPE TOTAL ACTIVE SIZE RECLAIMABLE Images 7 5 1.135GB 744.7MB (65%) Containers 72 2 697.4MB 697.4MB (99%) Local Volumes 0 0 0B 0B Build Cache 147 0 12.1GB 12.1GB
[root@youtmd /]# docker builder prune WARNING! This will remove all dangling build cache. Are you sure you want to continue? [y/N] y ID RECLAIMABLE SIZE LAST ACCESSED yd12c76cca83sw9unp0qsu4wh* true 0B 2 months ago ieu32wpuvshcdbjfbm8480v6r* true 0B 25 hours ago q40jvchqq7ck1m90n5u5369ls* true 149.8MB 4 days ago 4geyeu6k34fojqdh7e22vd48j* true 152.9MB 25 hours ago . . .