Fork me on GitHub

Remover

Description: Removes all docker containers and images.

#!/bin/bash
#Description

#Script to stop and remove all docker containers and images
echo "Removing all docker containers and images!"

#Stop all running docker containers
echo "Stopping all containers.. Please wait"
docker stop $(docker ps -aq)
echo "Stopping all containers.. Process completed!"

#Remove all docker containers
echo "Removing all  containers.. Please wait"
docker rm $(docker ps -aq)
echo "Removing all container.. Process completed!"

#Remove all docker images
echo "Removing all images.. Please wait"
docker rmi $(docker images -q)
echo "Removing all images.. Process completed!"


Download the Script here.