简体   繁体   中英

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

是否存在任何已知的解决方案,以使外部计算机能够连接到docker swarm覆盖网络上的容器?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM