Usefull commands
The most elegant way to remove all non-running containers seems to be:
docker rm $(docker ps -q -f status=exited)
-q
prints just the container ids (without column headers)-f
allows you to filter your list of printed containers (in this case we are filtering to only show exited containers)