Docker – remove exited containers and dangling volumes

Here’s my dockernuke script which does what it says it does when it says it’s doing it.

#!/bin/sh
echo find and destroy exited containers
echo ---
sudo docker rm $( echo $( \
sudo docker ps -a --filter="status=exited" -q) )
echo ...
echo find and destroy orphaned volumes
echo ---
sudo docker volume rm $( \
sudo docker volume ls -q -f 'dangling=true' )
echo ...
echo "tabula rasa!"