The way of docker clear disk space

The way of docker clear disk space

Table of contents

No heading

No headings in the article.

Before I know, if the docker used too much disk space, we just ran this command to remove all stoped containers, dangling images and build cache from old images:

docker system prune

It will tell you to confirm that you want to delete all of them, then just delete them quickly.But we check the disk space is not reduced on Docker desktop’s preferences tab.

So what we should do to really release the disk space immediately?

I search it in google for a long time, then I found this solution:

To avoid that, one trick that I usually do is to reduce the size to 8GB and increase it back to 32GB using Docker preferences.

For example, currently the disk space has been more than 100GB, we can adjust it to be 64GB, or 32GB.After it restart, the disk space would reduced to be less than 64G, but actually the related data might not be lost as it mentioned before.

That’s the final resolution for this kind of issue.