How to remove old Docker containers

To remove all Docker containers, you can use the command below which will delete all stopped containers:

docker container prune                                                                                     [docker remove all stopped containers]

If however you would like to remove all docker images (dangling and unreferenced), volumes, unused containers, run the command below:

docker system prune                                                                                          [docker remove all images]

The solution above is valid for Docker 1.13.x and above.

Read: How to create new users in a Docker container?

Answer due to Ken Cochrane



If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.


Nikolaus Oosterhof

Nikolaus holds a degree in software development and has a strong passion for all things tech-related, especially gadgets with screens. Though he is nostalgic for older phone models, he's a retired gamer and continues to enjoy programming in open-source environments. Additionally, Nikolaus enjoys writing about Linux, macOS and Windows and has experience designing web pages.

Leave a Reply