Linux/Docker/Networking: Difference between revisions

From Wiki
< Linux‎ | Docker
mNo edit summary
mNo edit summary
Line 15: Line 15:
<pre>
<pre>
docker exec --privileged munin ip route add 192.168.111.0/24 via 172.1.50.127
docker exec --privileged munin ip route add 192.168.111.0/24 via 172.1.50.127
nsenter -t $(docker inspect --format {{.State.Pid}} webproxy) ip route add 192.168.111.0/24 via 172.1.50.127
<pre>
<pre>


[[Category:Linux/Docker]]
[[Category:Linux/Docker]]
[[Category:Linux]]
[[Category:Linux]]

Revision as of 21:04, 15 November 2023

  • List docker container with IPs
docker ps -q | xargs -n 1 docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}} {{ .Name }}' | sed 's/ \// /'
  • Create docker network
docker network create wireguard
docker network create --subnet 172.1.50.0/24 wireguard
docker network create --subnet 172.1.50.0/24 --ip-range=172.1.50.0/25 wireguard
docker network inspect wireguard
  • add custom route to docker container
docker exec --privileged munin ip route add 192.168.111.0/24 via 172.1.50.127
nsenter -t $(docker inspect --format Template:.State.Pid webproxy) ip route add 192.168.111.0/24 via 172.1.50.127