docker build --tag tun_mesh .
Note the pause
containers.
These provide the common network environment within a group of deployed containers.
NOTE: The pause containers need to be manually cleaned up, see Cleanup
section.
docker run -d --name=tm1 -p 4567:4567 registry.k8s.io/pause
docker run --rm -ti --net=container:tm1 --device=/dev/net/tun --cap-add=cap_net_admin --cap-add=cap_net_raw -v $(pwd)/etc/test_config:/etc/tunmesh:ro -e TUNMESH_CONFIG_PATH=/etc/tunmesh/config.1.yaml tun_mesh
- Note NAT on the port listener
docker run -d --name=tm2 -p 4568:4567 registry.k8s.io/pause
docker run --rm -ti --net=container:tm2 --device=/dev/net/tun --cap-add=cap_net_admin --cap-add=cap_net_raw -v $(pwd)/etc/test_config:/etc/tunmesh:ro -e TUNMESH_CONFIG_PATH=/etc/tunmesh/config.2.yaml tun_mesh
- Note NAT on the port listener
docker run -d --name=tm3 -p 4569:4567 registry.k8s.io/pause
docker run --rm -ti --net=container:tm3 --device=/dev/net/tun --cap-add=cap_net_admin --cap-add=cap_net_raw -v $(pwd)/etc/test_config:/etc/tunmesh:ro -e TUNMESH_CONFIG_PATH=/etc/tunmesh/config.3.yaml tun_mesh
- Note that this is running a new container in the
tm1
network namespace.- A application started with the same
net=
setting will have transparent IP access to the other nodes in the mesh via the internal IPs.
- A application started with the same
docker run --rm -ti --net=container:tm1 tun_mesh ping 192.168.129.30
docker rm -f tm1 tm2 tm3