Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (2.3k points)
How can I remove all of my old containers?

1 Answer

0 votes
by (6.9k points)

For all the new versions of docker (Docker 1.13.x) You can do so using the container prune command:

$ sudo docker container prune

This should remove any and all of the stopped containers

You can also make use of the docker system prune command:

$ sudo docker system prune

This command should remove all of the unused docker networks, images, containers

For all the older version of docker you put commands together like so:

$ sudo docker ps --filter "status=exited" | grep 'weeks ago' | awk '{print $1}' | xargs --no-run-if-empty docker rm

Fill the tags according to your needs

Hope this helped :)


Anyway, I understand that docker can be a tough topic to understand and learn, so if you want help from someone with years of experience try out learning docker in docker training course.

Browse Categories

...