-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathteardown.sh
More file actions
executable file
·22 lines (17 loc) · 831 Bytes
/
Copy pathteardown.sh
File metadata and controls
executable file
·22 lines (17 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash
set -euo pipefail
LEFT_CONTAINER="${LEFT_CONTAINER:-left}"
RIGHT_CONTAINER="${RIGHT_CONTAINER:-right}"
TAP_LEFT="${TAP_LEFT:-tapa}"
TAP_RIGHT="${TAP_RIGHT:-tapb}"
BR_LEFT="${BR_LEFT:-br-inet-left}"
BR_RIGHT="${BR_RIGHT:-br-inet-right}"
NET_LEFT="${NET_LEFT:-inet-left}"
NET_RIGHT="${NET_RIGHT:-inet-right}"
docker rm -f "${LEFT_CONTAINER}" "${RIGHT_CONTAINER}" 2>/dev/null || true
docker network rm "${NET_LEFT}" "${NET_RIGHT}" 2>/dev/null || true
# Docker should remove these bridges when the networks are removed, but clean them up anyway.
sudo ip link delete "${BR_LEFT}" type bridge 2>/dev/null || true
sudo ip link delete "${BR_RIGHT}" type bridge 2>/dev/null || true
sudo ip tuntap del mode tap dev "${TAP_LEFT}" 2>/dev/null || true
sudo ip tuntap del mode tap dev "${TAP_RIGHT}" 2>/dev/null || true