Last Updated: March 06, 2018
·
2.614K
· hopsoft

Remove non-running Docker containers

Docker lacks a "clean" command, but you can easily cleanup unused containers by running this script. Note: This will remove any non-running containers.

docker ps -a | cut -c-12 | xargs docker rm

Read more here: https://github.com/dotcloud/docker/issues/928

2 Responses
Add your response

This will remove ALL containers

over 1 year ago ·

Running this command sufficient enough, or is this a better alternative to:
$ docker system prune -a

over 1 year ago ·