Deleting unnecessary Images and Containers in Docker

Updated: March 4, 2022 By: A Goodman Post a comment

This concise article shows you how to remove unused containers and images from your computer to gain free disk space.

First, check images space usage, containers space usage, local volumes usage, and build cache usage by performing the following command:

docker system df -v

You will see a lot of information like this:

Now you can delete all build-cache, unused networks, stopped containers, and dangling images by executing the command below:

docker system prune

You will be asked to confirm your decision. Enter “y” to continue:

When the process is done, you will see a message like this:

Total reclaimed space: 1343541B

Done. Further reading:

You can also check out our Docker topic page for the latest tutorials, examples, tips, and tricks.

Notify of
Inline Feedbacks
View all comments

Related Articles