To delete all the containers we have created so far:

docker rm $(docker ps -a -q)

To delete all the images in docker:

docker rmi $(docker images -q)

NB: Deleting docker containers and images is not reversible. Make sure you know what you are upto.

Ref: Docker Issue