Earlier today I installed Docker and followed a few tutorials. When running a tutorial on using Docker with a barebones Meteor app, I got an error that there was not enough disk space, even though my /home
partition has 17 GB free.
I restarted my computer and it informed me that The volume "Filesystem root" has 0 bytes disk space remaining
. None of my browsers wanted to launch in such a suffocating space.
I ran sudo apt-get remove docker-ce docker-ce-cli containerd.io
and this reclaimed 33.4 MB of disk space on /
, which meant I could launch a browser and look for hints on how to reclaim more space. After removing an old kernel, running sudo apt autoremove --purge
and sudo apt-get clean
and removing a number of third-party apps that I haven't used for a while, I have been able to claim back a total of just over 800 MB, so at least I have some breathing space.
However, it seems a coincidence that the installation of Docker and the creation of half a dozen images led to my 19 GB /
partition suddenly becoming saturated. It also seems that there must still be a lot of space that has not been released, forcing me to remove other files which previously caused no bother.
Is there something special that Docker does to /
, and is there something I can do to I undo it, and avoid having it happen again?
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3,8G 0 3,8G 0% /dev
tmpfs 783M 9,6M 773M 2% /run
/dev/nvme0n1p5 19G 17G 776M 96% /
tmpfs 3,9G 468K 3,9G 1% /dev/shm
tmpfs 5,0M 4,0K 5,0M 1% /run/lock
tmpfs 3,9G 0 3,9G 0% /sys/fs/cgroup
...
/dev/nvme0n1p6 465M 80M 357M 19% /boot
/dev/nvme0n1p7 77G 57G 17G 78% /home
/dev/nvme0n1p1 496M 82M 415M 17% /boot/efi
tmpfs 783M 52K 783M 1% /run/user/1000
Получается, что:
/ var / lib / docker /
$ docker images -a
REPOSITORY TAG IMAGE ID CREATED SIZE
<none> <none> 33b3559a88ad 2 minutes ago 907MB
<none> <none> f2136da9e497 2 minutes ago 907MB
node 12.6 7c412a558705 12 months ago 907MB
Это (вместе с другими моими экспериментами) быстро заполнило мой раздел размером 19 ГБ.
Чтобы решить проблему, я последовал совету здесь , чтобы создать символическую ссылку из / var / lib / docker /
в папку на более широкой равнине моего раздела / home
. И мой раздел /
благодарит меня за это:
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 3,8G 0 3,8G 0% /dev
tmpfs 783M 9,7M 773M 2% /run
/dev/nvme0n1p5 19G 15G 3,3G 82% /
...
Я также использовал docker rmi $ (docker images -a -q)
и docker image prune
для удаления огромные файлы, которые я создал во время экспериментов, которые больше не нужны.