How to connect to containers on docker Overlay network from an external machine

952 views Asked by At

Is there any known solution for enabling an external machine to connect to the containers on a docker swarm overlay network?

1

There are 1 answers

0
TheWizard On

The question is legitimate, see example below, however I do not know of a simple solution for it, I'll propose offhand a possible solution and would test later and update.

Suppose you have a docker overlay network of many Kafkas running on a couple of nodes (container hosts). All Kafka brokers communicate with each other beautifully.

When a Kafka client needs to access a Kafka broker it connects to it (say somehow, supposedly even through Swarm's service external port), but then that broken may reply that that data is in another broker with and here is that other broker's IP (on the overlay network)... meaning Kafka client must be able to access to all Kafka brokers (overlay network).

You can do this easily if everything is containerized, but what if not?

You can do this with SDN, or an offhand solution: A container with two networks serving as a router with one "leg" on the overlay network and the other l2bridged to where that other VM or host is and route through it, you'd have to Swarm "constrain" it to run where the network from which you want overlay network access is available. that should work!

If someone has another clean/clear solution I'm very interested too