-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdestroy-docker.sh
More file actions
executable file
·48 lines (37 loc) · 930 Bytes
/
destroy-docker.sh
File metadata and controls
executable file
·48 lines (37 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# VERSION
version='1.0'
# OUTPUT VARS
TERM=xterm
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
bold=`tput bold`
reset=`tput sgr0`
# Check if running as root
if [ "$EUID" -ne 0 ]
then echo "${red}Please run as root: ${reset}${bold}sudo ./destroy-docker.sh${reset}"
exit
fi
echo ""
echo "When proceeding, the explorer-api docker container and image ${red}will be deleted.${reset}"
echo ""
read -r -p "Continue? [y/N] " response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y) ]]; then
echo "Stopping Container..."
docker container stop explorer-api
echo "Removing Container..."
docker container rm explorer-api
echo "Removing image..."
docker image rm blocklattice.org/explorer-api
# Check errors
if [ $? -ne 0 ]; then
echo "${red}It seems errors were encountered. ${reset}"
exit 2
else
echo "Done, destroyed."
fi
else
echo "Cancelled."
fi