Browse Source

readme: single command to add route

Fabian Peter Hammerle 3 years ago
parent
commit
a33b36c68f
2 changed files with 4 additions and 14 deletions
  1. 3 14
      README.md
  2. 1 0
      docker-compose.yml

+ 3 - 14
README.md

@@ -1,19 +1,8 @@
 ```sh
-$ docker-compose up
+$ sudo docker-compose up
 ...
 gateway_1  | + openvpn --config /vpn-config/hackthebox.ovpn --user openvpn --group openvpn
 ...
-
-$ docker network inspect hacktheboxgateway_default | jq '.[0]["Containers"]'
-{
-  "abcdef": {
-    "Name": "hacktheboxgateway_gateway_1",
-    "EndpointID": "ghijkl",
-    "MacAddress": "02:42:c0:a8:40:02",
-    "IPv4Address": "192.168.64.2/20",
-    "IPv6Address": ""
-  }
-}
-
-$ ip route add 10.10.10.0/24 via 192.168.64.2
+$ sudo ip route add 10.10.10.0/24 via \
+    "$(sudo docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' hackthebox_gateway)"
 ```

+ 1 - 0
docker-compose.yml

@@ -7,6 +7,7 @@ services:
   gateway:
     build: .
     image: fphammerle/hackthebox-gateway
+    container_name: hackthebox_gateway
     volumes:
     - vpn_config:/vpn-config:ro
     devices: