gpt4 book ai didi

docker -/var/lib/docker/overlay2/*/merged 占用的空间过多

转载 作者:行者123 更新时间:2023-12-04 19:24:31 24 4
gpt4 key购买 nike

问题描述:
在我的系统中,/var/lib/docker/overlay2/*/merged 占用了太多空间,详细信息如下所示。

root@sriov-TaiShan-200:~# df -h --total
Filesystem Size Used Avail Use% Mounted on
udev 63G 0 63G 0% /dev
tmpfs 13G 6.2M 13G 1% /run
/dev/nvme0n1p2 2.9T 2.4T 329G 89% /
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/loop0 128K 128K 0 100% /snap/bare/5
/dev/loop1 49M 49M 0 100% /snap/core18/2406
/dev/loop2 49M 49M 0 100% /snap/core18/2349
/dev/loop3 58M 58M 0 100% /snap/core20/1437
/dev/loop5 229M 229M 0 100% /snap/gnome-3-38-2004/100
/dev/loop6 73M 73M 0 100% /snap/lxd/23043
/dev/loop7 198M 198M 0 100% /snap/gnome-3-34-1804/73
/dev/nvme0n1p1 512M 5.2M 507M 1% /boot/efi
/dev/loop8 66M 66M 0 100% /snap/gtk-common-themes/1519
/dev/loop9 49M 49M 0 100% /snap/snap-store/545
/dev/loop10 229M 229M 0 100% /snap/gnome-3-38-2004/88
/dev/loop11 39M 39M 0 100% /snap/snapd/15541
/dev/loop14 198M 198M 0 100% /snap/gnome-3-34-1804/75
/dev/loop15 73M 73M 0 100% /snap/lxd/23003
/dev/loop16 53M 53M 0 100% /snap/snap-store/559
//10.67.93.97/work 916G 816G 100G 90% /mnt
/dev/loop17 82M 82M 0 100% /snap/gtk-common-themes/1534
/dev/loop13 39M 39M 0 100% /snap/snapd/15909
/dev/loop12 58M 58M 0 100% /snap/core20/1498
tmpfs 13G 16K 13G 1% /run/user/0
tmpfs 126G 12K 126G 1% /var/lib/kubelet/pods/12baa83c-6696-43f3-b060-85ba620867aa/volumes/kubernetes.io~projected/kube-api-access-j26q8
overlay 2.9T 2.4T 329G 89% /var/lib/docker/overlay2/150f4adf713b9882cd39e5580204040f20dcebf20205c9c62b55a85ac416da89/merged
shm 64M 0 64M 0% /var/lib/docker/containers/9b02ed0d68aa3c24531b1e2852861a202b36b9d7d08645ee170035a3eab48747/mounts/shm
overlay 2.9T 2.4T 329G 89% /var/lib/docker/overlay2/803a832d1a228c7e57b47b9d53244deadc98dbe41248a478d3b6981bc111832d/merged
total 9.9T 8.0T 1.4T 86% -
root@sriov-TaiShan-200:~# docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 2 2 109.7MB 0B (0%)
Containers 2 2 2.294kB 0B (0%)
Local Volumes 0 0 0B 0B
Build Cache 0 0 0B 0B
root@sriov-TaiShan-200:~# du -h --max-depth=1 /var/lib/docker/overlay2 | sort -rh | head -25
223M /var/lib/docker/overlay2
111M /var/lib/docker/overlay2/803a832d1a228c7e57b47b9d53244deadc98dbe41248a478d3b6981bc111832d
68M /var/lib/docker/overlay2/6b7c00ae09c4df6f35e65114513bd6216c2436e62ae26c3b91b4c2ab60734662
42M /var/lib/docker/overlay2/94b81b09cc4a7ca3ead72888264e3cff25af77d2fc00334847aa2c3bde225e8a
1.6M /var/lib/docker/overlay2/65ca885064b7df65728ea2864d3f633f035d4b9f3348ae4bcdc8c926157b9552
528K /var/lib/docker/overlay2/150f4adf713b9882cd39e5580204040f20dcebf20205c9c62b55a85ac416da89
488K /var/lib/docker/overlay2/5e344fbdc03c21013a38b1a82987d7e9094b5d13fe96d0f89f6e31a096f51c9c
48K /var/lib/docker/overlay2/150f4adf713b9882cd39e5580204040f20dcebf20205c9c62b55a85ac416da89-init
36K /var/lib/docker/overlay2/l
32K /var/lib/docker/overlay2/803a832d1a228c7e57b47b9d53244deadc98dbe41248a478d3b6981bc111832d-init
我尝试过的事情:
  • 扩展 lv/dev/ubuntu-vg/ubuntu-lv 大小但没有幸运
  • 使用以下步骤重新安装 docker 但没有幸运
  • apt-get purge docker-ce
    rm -rf /var/lib/docker
    rm -rf /etc/docker
    apt-get remove docker docker-engine docker.io containerd runc
    /etc/apt/sources.list.d/docker.list > /dev/null
    apt update
    mkdir -p /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    apt update
    apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
  • docker system prune -a 但没有运气
  • root@sriov-TaiShan-200:~# 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
    Total reclaimed space: 0B
    更新
    似乎 docker 并没有使用那么多磁盘空间。通过 du 结果,占用空间的是其他事物。然而覆盖 2.9T 2.4T 329G 89%/var/lib/docker/overlay2/803a832d1a228c7e57b47b9d53244deadc98dbe41248a478d3b6981bc111832d/merged 相当困惑。
    root@sriov-TaiShan-200:# du -h --max-depth=1 / --exclude=mnt --exclude=proc --exclude=home | sort -rh
    2.3T /
    1.6T /var
    686G /root
    15G /usr
    6.1G /snap
    3.6G /x86_64-linux-gnu
    1.2G /boot
    88M /opt
    16M /etc
    6.2M /run
    92K /tmp
    16K /lost+found
    12K /media
    4.0K /srv
    4.0K /cdrom
    0 /sys
    0 /dev

    最佳答案

    合并的文件夹是覆盖文件系统,它们本身不占用磁盘空间,而是 df 报告底层文件系统的磁盘使用情况,在您的情况下为 / :

    /dev/nvme0n1p2      2.9T  2.4T  329G  89% /
    overlay 2.9T 2.4T 329G 89% /var/lib/docker/overlay2/150f4adf713b9882cd39e5580204040f20dcebf20205c9c62b55a85ac416da89/merged
    overlay 2.9T 2.4T 329G 89% /var/lib/docker/overlay2/803a832d1a228c7e57b47b9d53244deadc98dbe41248a478d3b6981bc111832d/merged
    磁盘使用可以在根文件系统上的任何位置,因此您需要检查整个驱动器以查找磁盘空间正在使用的位置。这可能与docker无关。

    1. extend lv /dev/ubuntu-vg/ubuntu-lv size but no lucky

    您的根文件系统被列为 /dev/nvme0n1p2 ,所以我不确定更改 lv 会如何影响它。

    对于容器,使用磁盘的常见地方是:
  • 图像层
  • 容器 RW 文件系统(从应用程序写入容器文件系统)
  • 容器输出日志

  • docker 中的快速清理是 docker system prune .有更多的选择,以及 this answer 中描述的修剪中未包含的内容。 .

    关于docker -/var/lib/docker/overlay2/*/merged 占用的空间过多,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/72399311/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com