about summary refs log tree commit diff
diff options
context:
space:
mode:
authormaride <maride@darknebu.la>2018-09-08 02:18:52 +0200
committermaride <maride@darknebu.la>2018-09-08 02:18:52 +0200
commit116b1472cf69f920e27da36702a39959bc83b315 (patch)
treed5f69366393320c5a91130ab6a4ed0d09115681d
parentcbf9d2e98405081f83755725583c5ef3b5666ec3 (diff)
Fix: allow VPN network to be deletable, too (disconnect companion from that network)
-rw-r--r--src/access.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/access.go b/src/access.go
index 69c8fb1..233b11c 100644
--- a/src/access.go
+++ b/src/access.go
@@ -135,6 +135,9 @@ func stopVPN() {
 	timeout := time.Second * 5
 	dockerCli.ContainerStop(dockerCtx, vpnContainerID, &timeout)
 
+	// We need to undo our stunt! Else, the network won't be deletable because "there are active endpoints"
+	dockerCli.NetworkDisconnect(dockerCtx, vpnHostNetworkID, os.Getenv("HOSTNAME"), true)
+
 	vpnContainerID = ""
 }