docker prune all containers and images code example
Example 1: remove stopped containers
$ docker rm $(docker ps -a -q)
Example 2: docker prune images
docker image prune -a -f
$ docker rm $(docker ps -a -q)
docker image prune -a -f