In order to delete all images, use the given command
docker rmi $(docker images -q)
In order to delete all containers, use the given command
docker rm $(docker ps -a -q)
Warning: This will destroy all your images and containers. It will not be possible to restore them!
This solution is provided by Techoverflow.net.