writinggugl.blogg.se

Docker clean disk space
Docker clean disk space













docker clean disk space

It’s a small price to pay considering that Docker was using more than 5% of my disk space. It did the trick for me, at the cost of losing all the images I had pulled. Sadly, the only solution that works is to go into Docker Desktop, click on the troubleshoot button, and hit the Clean / Purge data button. It seems that no matter how few images you have, the Docker VHDX refuses to hand back the disk space it once needed. A 4GB image for about 1GB of images The Nuclear OptionĪfter a bit of Googling, I came across this thread on the Docker GitHub repository with others having a similar problem. But if you’re like me, and the VHDX is still magnitudes of size bigger than the number of images you have, then it’s time for a deeper cleanse. If the displayed size is about what you’d expect it to be relative to the number of images you have, then you’re all done. Have a look at the size of your VHDX files located in C:\\AppData\Local\Docker\wsl. Instead of executing each of the previous prune commands individually, you could use the docker system prune command, which performs a prune on containers, images and a few other less-storage-hungry components within Docker.īy this point, you should have hopefully reclaimed a fair amount of space. These are image layers that have no relation to any other image in Docker and are no longer needed. Now that you’ve removed all the images you don’t need anymore, it’s time to run a docker image prune to remove dangling images. Depending on how many images you’ve accumulated over time, it could save you a fair amount of disk space. You can list all the images on your computer with the docker image list command, and remove an image that you don’t need by using the docker image rm command. The next step is to look at the images list and remove those that you don’t need anymore. Docker will even tell you how much space it’s managed to reclaim. You can wipe them by running docker container prune. Unless you plan to restart any of these containers, they are hogging space for nothing. You can see them with the docker ps -a command. The first place to start is to remove any stopped containers that aren’t running. I was really surprised to notice that the virtual drive (VHDX) that Docker uses in WSL2 had ballooned up to 17Gb! That’s when I decided to go through the official cleanup steps for Docker, including the final, less-known approach I used to finally reclaim most of that disk space.

docker clean disk space

Heavy Docker usage doesn’t help - it’s all too easy to accumulate many images over a short period of time.

Docker clean disk space free#

I have a 256Gb SSD that I struggle to keep under the 25% free space recommendation for drives of this type. Disk space is the most limited resource on my laptop.















Docker clean disk space