0

In most cases you have a docker container that you expose a port on the host so it can be accessed on to your local network ... what I am trying to do is the exact opposite.

I have an application that is designed to discover and manage IoT devices on a network. I have x1000+ docker containers setup like various IoT devices and would now like to have my windows application (running on a different machine) be able to search the 172.17.x.x virtual network within docker for stress testing.

I could setup a single docker node to act as a pptp vpn that I could have the windows machine connect too ... but I am wondering if there is a simpler solution.

0

This is not the full answer because technically its not adding a computer to the internal docker network, however, you can communicate with a docker network from a computer on the hosts network.

For example, if you have the following real network devices:

  • 192.168.1.1 - (r1) network router
  • 192.168.1.2 - (h2) random computer
  • 192.168.1.3 - (h3) docker host

and the following docker network:

  • 172.17.0.1 - (d1) docker router (you dont have to set it up ... its just there)
  • 172.17.0.2 - (d2) docker node

by default you can ping (r1),(h2),(h3) from (d2)

if however you want to ping (d2) from (h2) you will need to setup a route for the 172.17.0.0 network. This can be achieved by enabling routing on (h3) with:

sysctl -w net.ipv4.ip_forward=1

and then set a static route in either (h2) or (r1) with:

route add -net 172.17.0.0 netmask 255.255.0.0 gw 192.168.1.3

The end result will be that (h2) can communicate with any device on the 172.17.0.0 network with out needing to bind ports to the docker host or setup aliases to eth0 on the docker host.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.