快活林资源网 Design By www.csstdc.com
无意中感觉磁盘空间不够用,于是使用df -a命令查看,结果令人大吃一惊,全是docker干的好事,在/var/lib/docker/aufs里生成了一堆垃圾:
davidhopper@davidhopper-ThinkPad-P50s:~$ df -a 文件系统 1K-块 已用 可用 已用% 挂载点 sysfs 0 0 0 - /sys proc 0 0 0 - /proc udev 8112832 0 8112832 0% /dev devpts 0 0 0 - /dev/pts tmpfs 1627828 9580 1618248 1% /run /dev/sda6 84293120 77948404 2039772 98% / securityfs 0 0 0 - /sys/kernel/security tmpfs 8139124 18040 8121084 1% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 8139124 0 8139124 0% /sys/fs/cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd pstore 0 0 0 - /sys/fs/pstore efivarfs 0 0 0 - /sys/firmware/efi/efivars cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio cgroup 0 0 0 - /sys/fs/cgroup/perf_event cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct cgroup 0 0 0 - /sys/fs/cgroup/pids cgroup 0 0 0 - /sys/fs/cgroup/devices cgroup 0 0 0 - /sys/fs/cgroup/cpuset cgroup 0 0 0 - /sys/fs/cgroup/rdma cgroup 0 0 0 - /sys/fs/cgroup/blkio cgroup 0 0 0 - /sys/fs/cgroup/hugetlb cgroup 0 0 0 - /sys/fs/cgroup/freezer cgroup 0 0 0 - /sys/fs/cgroup/memory systemd-1 - - - - /proc/sys/fs/binfmt_misc debugfs 0 0 0 - /sys/kernel/debug mqueue 0 0 0 - /dev/mqueue hugetlbfs 0 0 0 - /dev/hugepages fusectl 0 0 0 - /sys/fs/fuse/connections configfs 0 0 0 - /sys/kernel/config /dev/sda1 262144 33084 229060 13% /boot/efi binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc tmpfs 1627828 56 1627772 1% /run/user/1000 gvfsd-fuse 0 0 0 - /run/user/1000/gvfs /dev/sda6 84293120 77948404 2039772 98% /var/lib/docker/aufs
首先使用最简单的方法,清理当前未运行的所有Docker容器:
docker system prune
运行结果如下:
davidhopper@davidhopper-ThinkPad-P50s:~/code/apollo$ docker system prune WARNING! This will remove: - all stopped containers - all volumes not used by at least one container - all networks not used by at least one container - all dangling images Are you sure you want to continue"htmlcode">sudo rm -rf /var/lib/docker/aufs结果令人失望,提示信息如下:
davidhopper@davidhopper-ThinkPad-P50s:~$ sudo rm -rf /var/lib/docker/aufs [sudo] davidhopper 的密码: rm: 无法删除'/var/lib/docker/aufs': 设备或资源忙用命令
cat /proc/mounts | grep "docker"
查找设备加载情况,果然有aufs:davidhopper@davidhopper-ThinkPad-P50s:~$ cat /proc/mounts | grep "docker" /dev/sda6 /var/lib/docker/aufs ext4 rw,relatime,errors=remount-ro,data=ordered 0 0没办法,逼我用绝招,先缷载设备,再删除之:
sudo umount /var/lib/docker/aufs sudo rm -rf /var/lib/docker/aufs再次使用df -a命令查看,结果令人神清气爽:
davidhopper@davidhopper-ThinkPad-P50s:~$ df -a 文件系统 1K-块 已用 可用 已用% 挂载点 sysfs 0 0 0 - /sys proc 0 0 0 - /proc udev 8112832 0 8112832 0% /dev devpts 0 0 0 - /dev/pts tmpfs 1627828 9584 1618244 1% /run /dev/sda6 84293120 65296764 14691412 82% / securityfs 0 0 0 - /sys/kernel/security tmpfs 8139124 18256 8120868 1% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 8139124 0 8139124 0% /sys/fs/cgroup cgroup 0 0 0 - /sys/fs/cgroup/systemd pstore 0 0 0 - /sys/fs/pstore efivarfs 0 0 0 - /sys/firmware/efi/efivars cgroup 0 0 0 - /sys/fs/cgroup/net_cls,net_prio cgroup 0 0 0 - /sys/fs/cgroup/perf_event cgroup 0 0 0 - /sys/fs/cgroup/cpu,cpuacct cgroup 0 0 0 - /sys/fs/cgroup/pids cgroup 0 0 0 - /sys/fs/cgroup/devices cgroup 0 0 0 - /sys/fs/cgroup/cpuset cgroup 0 0 0 - /sys/fs/cgroup/rdma cgroup 0 0 0 - /sys/fs/cgroup/blkio cgroup 0 0 0 - /sys/fs/cgroup/hugetlb cgroup 0 0 0 - /sys/fs/cgroup/freezer cgroup 0 0 0 - /sys/fs/cgroup/memory systemd-1 - - - - /proc/sys/fs/binfmt_misc debugfs 0 0 0 - /sys/kernel/debug mqueue 0 0 0 - /dev/mqueue hugetlbfs 0 0 0 - /dev/hugepages fusectl 0 0 0 - /sys/fs/fuse/connections configfs 0 0 0 - /sys/kernel/config /dev/sda1 262144 33084 229060 13% /boot/efi binfmt_misc 0 0 0 - /proc/sys/fs/binfmt_misc tmpfs 1627828 52 1627776 1% /run/user/1000 gvfsd-fuse 0 0 0 - /run/user/1000/gvfs为了让docker以后不再占用更多空间,我们指定docker目录的最大空间,命令如下:
mkdir -p /var/lib/docker/devicemapper/devicemapper dd if=/dev/zero of=/var/lib/docker/devicemapper/devicemapper/data bs=1M count=0 seek=1024建立的文件最大尺寸为 1MB * 1024 = 10 GB
注意:
如果删除垃圾文件后,导致Docker无法使用,则可使用如下方法将相关文件全部删除,然后重新安装Docker。删除相关文件的方法如下:
1.查找Docker缓存文件位置
sudo find / -name "docker"在我机器上结果如下:
/sys/fs/cgroup/memory/docker /sys/fs/cgroup/blkio/docker /sys/fs/cgroup/hugetlb/docker /sys/fs/cgroup/pids/docker /sys/fs/cgroup/cpuset/docker /sys/fs/cgroup/perf_event/docker /sys/fs/cgroup/devices/docker /sys/fs/cgroup/net_cls,net_prio/docker /sys/fs/cgroup/freezer/docker /sys/fs/cgroup/cpu,cpuacct/docker /sys/fs/cgroup/systemd/docker /etc/default/docker /etc/docker /etc/init.d/docker /var/lib/docker /run/docker find: `/run/user/1000/gvfs': 权限不够 /usr/lib/docker /usr/share/code/resources/app/extensions/docker /usr/share/bash-completion/completions/docker /usr/bin/docker /home/davidhopper/Qt5.10.0/5.10.0/Src/qtwebengine/src/3rdparty/chromium/third_party/protobuf/jenkins/docker /home/davidhopper/.cache/bazel/_bazel_davidhopper/install/5b1e8be5d1d6766f635a7db5967707e9/_embedded_binaries/embedded_tools/tools/build_defs/docker /home/davidhopper/.vscode/extensions/njpwerner.autodocstring-0.2.0/.vscode-test/Visual Studio Code.app/Contents/Resources/app/extensions/docker /home/davidhopper/code/apollo/docker /home/davidhopper/code/protobuf-master/jenkins/docker /home/davidhopper/code/apollo1215/apollo/docker2.删除Docker缓存
复制代码 代码如下:sudo rm -rf /home/davidhopper/.cache/bazel/_bazel_davidhopper/install/5b1e8be5d1d6766f635a7db5967707e9/_embedded_binaries/embedded_tools/tools/build_defs/docker
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。
快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com
暂无评论...
更新日志
2024年12月27日
2024年12月27日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]