dns networks
This commit is contained in:
parent
9cbb7aa0e8
commit
093eb42b47
2 changed files with 16 additions and 4 deletions
|
@ -3,6 +3,12 @@ set -eo pipefail
|
|||
|
||||
dns_container_id="$(docker ps | grep "$OVPN_DNS_CONTAINER_NAME_PATTERN" | awk '{ print $1 }' 2> /dev/null)"
|
||||
if [ "$dns_container_id" != "" ]; then
|
||||
echo "Connecting network 'vpnet' to $dns_container_id"
|
||||
docker network connect ${OVPN_COMPOSE_NAME}_ovpn-net "$dns_container_id"
|
||||
echo "Found running DNS container $dns_container_id"
|
||||
existing_network_name="$(docker inspect "$dns_container_id" | jq -r '.[0].NetworkSettings.Networks | keys | .[0] ')"
|
||||
echo "Found network '$existing_network_name' connected to '$dns_container_id'"
|
||||
vpn_container_id="$(docker ps | grep "${OVPN_COMPOSE_NAME}_openvpn-1" | awk '{ print $1 }' 2> /dev/null)"
|
||||
echo "Connecting network '$existing_network_name' to $vpn_container_id"
|
||||
docker network connect "$existing_network_name" "$vpn_container_id"
|
||||
echo "Connecting network '${OVPN_COMPOSE_NAME}_ovpn-net' to $dns_container_id"
|
||||
docker network connect "${OVPN_COMPOSE_NAME}_ovpn-net" "$dns_container_id"
|
||||
fi
|
||||
|
|
|
@ -3,6 +3,12 @@ set -eo pipefail
|
|||
|
||||
dns_container_id="$(docker ps | grep "$OVPN_DNS_CONTAINER_NAME_PATTERN" | awk '{ print $1 }' 2> /dev/null)"
|
||||
if [ "$dns_container_id" != "" ]; then
|
||||
echo "Disconnecting network 'vpnet' from $dns_container_id"
|
||||
docker network disconnect ${OVPN_COMPOSE_NAME}_ovpn-net "$dns_container_id"
|
||||
echo "Found running DNS container $dns_container_id"
|
||||
existing_network_name="$(docker inspect "$dns_container_id" | jq -r '.[0].NetworkSettings.Networks | keys | .[0] ')"
|
||||
echo "Found network '$existing_network_name' connected to '$dns_container_id'"
|
||||
vpn_container_id="$(docker ps | grep "${OVPN_COMPOSE_NAME}_openvpn-1" | awk '{ print $1 }' 2> /dev/null)"
|
||||
echo "Disconnecting network '$existing_network_name' to $vpn_container_id"
|
||||
docker network disconnect "$existing_network_name" "$vpn_container_id"
|
||||
echo "Disconnecting network '${OVPN_COMPOSE_NAME}_ovpn-net' to $dns_container_id"
|
||||
docker network disconnect "${OVPN_COMPOSE_NAME}_ovpn-net" "$dns_container_id"
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue