-
Notifications
You must be signed in to change notification settings - Fork 0
/
flushalldocker.sh
59 lines (49 loc) · 1.52 KB
/
flushalldocker.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
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
echo "docker stop"
docker stop $(docker ps -a -q)
sudo docker stop $(sudo docker ps -a -q)
echo "docker rm"
docker rm $(docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
echo "docker rmi"
docker rmi $(docker images -q)
sudo docker rmi $(sudo docker images -q)
echo "docker volume rm"
docker volume rm $(docker volume ls -qf dangling=true)
sudo docker volume rm $(sudo docker volume ls -qf dangling=true)
echo "rm ..."
sudo rm -rf /etc/ceph \
/etc/cni \
/etc/kubernetes \
/opt/cni \
/opt/rke \
/run/secrets/kubernetes.io \
/run/calico \
/run/flannel \
/var/lib/calico \
/var/lib/etcd \
/var/lib/cni \
/var/lib/kubelet \
/var/lib/rancher/rke/log \
/var/log/containers \
/var/log/pods \
/var/run/calico
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
echo "rm -f /var/lib/containerd/io.containerd.metadata.v1.bolt/meta.db"
sudo rm -f /var/lib/containerd/io.containerd.metadata.v1.bolt/meta.db
cleanupinterfaces="flannel.1 cni0 tunl0"
for interface in $cleanupinterfaces; do
echo "Deleting $interface"
ip link delete $interface
done
IPTABLES="/sbin/iptables"
cat /proc/net/ip_tables_names | while read table; do
$IPTABLES -t $table -L -n | while read c chain rest; do
if test "X$c" = "XChain" ; then
$IPTABLES -t $table -F $chain
fi
done
$IPTABLES -t $table -X
done
echo "shutdown -r now"
sudo shutdown -r now