docker运行一段时间后如何查看日志占用的空间大小步骤

1、进入安装目录,默认情况下Docker的默认安装目录是/var/lib/docker
2、使用du命令查看文件夹的空间占用情况
du -h -x --max-depth=1
3、进入到containers目录中查看各个容器占用空间情况
cd containers/
du -h -x --max-depth=1
4、再进到指定的容器中查看文件占用情况
cd e58b4800172a0c0a991bb5b5436d0c70feba912693f6a64b19ea9c77ec2289c6/
ls -lh
检查过程
[root@mixfate-hk ~]# cd /var/lib/docker
[root@mixfate-hk docker]# du -h -x --max-depth=1
16K     ./plugins
196M    ./containers
4.0K    ./trust
4.0K    ./runtimes
4.0K    ./swarm
28K     ./volumes
4.0K    ./tmp
13M     ./image
80K     ./network
88K     ./buildkit
5.4G    ./overlay2
5.6G    .
[root@mixfate-hk docker]# cd containers/
[root@mixfate-hk containers]# du -h -x --max-depth=1
44K     ./dfc252ac964f294687d26a2a17d544bc123e63a3dbd6912ed7cd3caa27ca39eb
118M    ./e58b4800172a0c0a991bb5b5436d0c70feba912693f6a64b19ea9c77ec2289c6
61M     ./a6699d69604f1130f596cda5d38d7062601726ed30ac954dc1aef28c3dc74e20
18M     ./727c440dee9f562d637b84ebad9ab422fed25c77fb4ba056840c345d5c8535ef
196M    .
[root@mixfate-hk containers]# 
[root@mixfate-hk containers]# 
[root@mixfate-hk containers]# cd e58b4800172a0c0a991bb5b5436d0c70feba912693f6a64b19ea9c77ec2289c6/
[root@mixfate-hk e58b4800172a0c0a991bb5b5436d0c70feba912693f6a64b19ea9c77ec2289c6]# ls -lh
total 118M
drwx------ 2 root root 4.0K Apr  1  2023 checkpoints
-rw------- 1 root root 4.6K Sep 21 10:18 config.v2.json
-rw-r----- 1 root root 118M Oct  7 18:59 e58b4800172a0c0a991bb5b5436d0c70feba912693f6a64b19ea9c77ec2289c6-json.log
-rw-r--r-- 1 root root 1.7K Sep 21 10:18 hostconfig.json
-rw-r--r-- 1 root root   13 Sep 21 10:18 hostname
-rw-r--r-- 1 root root  174 Sep 21 10:18 hosts
drwx-----x 2 root root 4.0K Apr  1  2023 mounts
-rw-r--r-- 1 root root   88 Sep 21 10:18 resolv.conf
-rw-r--r-- 1 root root   71 Sep 21 10:18 resolv.conf.hash

赞赏(Donation)
微信(Wechat Pay)

donation-wechatpay