-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-nuke-all.sh
executable file
·50 lines (42 loc) · 1.29 KB
/
docker-nuke-all.sh
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
47
48
49
#!/bin/sh
#
# Software Name : Fossology Docker Deploy Scripts Suite
# Version: 1.0
# Copyright (c) 2020 Orange
# SPDX-License-Identifier: MIT
#
# This software is distributed under the MIT License
# the text of which is available at https://spdx.org/licenses/MIT.html
# or see the "LICENSE" file for more details.
#
# Author: Nicolas Toussaint [email protected]
#
#
# This file deletes ALL Docker containers and volumes.
# Only works if configured as a pre-productino environment in
# the configuration file.
cd $(dirname $0)
. ./setup-common.sh
f_blinking_warning "About to destroy the universe."
if f_is_production_env
then
echo "Sorry, this is NOT a PRE-production environment"
echo "That's making me nervous, quitting."
exit 1
fi
filter="-f name=fossology*"
#dry=echo
echo "* Stopping containers"
docker container ls -q $filter | xargs $dry docker container stop
echo "* Pruning containers"
docker container ls -aq $filter | xargs $dry docker container prune -f
echo "* Pruning volumes"
docker volume ls -q $filter | xargs $dry docker volume prune -f
echo "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"
echo "Containers:"
docker container ls $filter
echo
echo "Volumes:"
docker volume ls $filter
echo
echo "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --"