HOW TO REMOVE OLD DOCKER CONTAINERS?

How to remove old docker containers?

There is a new feature in Docker 1.13.x called Docker container prune: This will do what you want and will work on all platforms the same way.

There is also a Docker system prune, which will clean up containers, images, volumes, and networks all in one command.

Command:
Here is an example on how to clean up old containers that are weeks old:
$ docker ps –filter “status=exited” | grep ‘weeks ago’ | awk ‘{print $1}’ | xargs –no-run-if-empty docker rm

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>