cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove old and unused Docker images

williamsmith900
New Contributor

When running Docker for a long time, there are a lot of images in the system. How can I remove all unused Docker images at once safely to free up the storage?

In addition, I also want to remove images pulled months ago, So, I'm not asking for removing untagged images only. I'm searching for a way to remove general unused images.

I checked one docker blog online, but still, I was able to get rid of this problem.

Anyone can help!

2 REPLIES 2

Prabakar
Esteemed Contributor III
Esteemed Contributor III

@william smith​ you can use the prune command to remove the unused docker image.

docker image prune -a --force --filter "until=720h"

This command removes images created more than 30 days (720h) ago.

You need to modify the filter parameter as per your requirement.

Official docker document should help you.

Anonymous
Not applicable

Hey there @william smith​ 

Hope everything is going great!

Does @Prabakar Ammeappin​'s response answer your question? If yes, would you be happy to mark it as best so that other members can find the solution more quickly? Else please let us know if you need more help. 

We'd love to hear from you.

Thanks!

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.