Tag Archives: old docker containers

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