Skip to content
Snippets Groups Projects
Commit 83a63598 authored by victarr's avatar victarr
Browse files

Add new file

parent de28fc3f
Branches
No related tags found
No related merge requests found
#!/bin/bash
#
# Removes ALL containers in a given docker instance.
#
# USE WITH CARE
#
# Author: Valentín Cardeñoso Payo
# Date: 2-mar-2022
ME=$(basename $0)
CLIST="$(docker container ls -a | cut -d' ' -f1 | egrep ".*[0-9].*")"
if [ "$CLIST" == "" ]
then echo -e "\n\t$ME: There is no container to remove ...\n"
exit 1
else
echo -e "\n\t$ME: You are about to remove the following containers:"
echo "$CLIST" | sed -e 's: :\n:g'
echo -e -n "\n\nAre you sure? [N/y]: " && read ans
if [ "$ans" == "y" ]
then docker container rm -f $CLIST
else echo -e "\n\n\t$ME: Containers were NOT REMOVED. Exiting."
fi
fi
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment