Stop and remove all running containers:
docker stop $(docker ps -aq) && docker rm $(docker ps -aq)
Remove all stopped containers:
docker rm $(docker ps -aq)
Remove untagged/dangling/<none> images
docker rmi $(docker images -q -f dangling=true)
#Install utilities
Install ping (Ubuntu)
apt-get install iputils-ping
Install nslookup (Debian, Ubuntu)
apt-get install dnsutils
#See also
wsargent/docker-cheat-sheet
Docker Cleanup Commands