Docker Swarm-网络覆盖未连接所有容器 [英] Docker Swarm - Network Overlay not connecting all containers

查看:117
本文介绍了Docker Swarm-网络覆盖未连接所有容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前使用Docker Swarm和Consul设置了3个EC2实例。我有3个简单的节点应用程序分布在所有3个实例上,然后使用nginx在我的群集主服务器上进行路由。



使用指南覆盖网络,我创建了一个名为 mynet ,并将每个容器都连接到该网络。使用 docker inspect ,我可以确认每个节点容器和nginx容器都已连接到 mynet 并具有IP。但是,在进入我的nginx容器后,它只能通过网络与位于同一主机上的节点应用程序通信,而不能与集群中其他主机上的节点应用程序通信。



运行 docker网络检查mynet 后,仅列出了我的两个容器(位于同一主机上的nginx和一个节点实例),而其他两个都没有列出,即使它们具有 docker inspect 的覆盖网络的名称和IP。



该想法是使用 nginx反向代理向其配置中添加任何在线的新容器,但被困在使容器全部连接的问题上。根据用于覆盖的Docker网络文档,这应该是可能的。



我在做什么错?谢谢。



编辑:



发送垃圾邮件 docker网络后检查mynet 几次,即使我关闭了所有防火墙并打开了端口以进行测试,容器似乎仍在不断地与网络连接和断开连接。会导致什么呢?

解决方案

原来有两个问题导致了我的问题。



一个是我正在使用3.13,其中 docker网络覆盖不支持。升级到3.16可解决此问题。其次是Swarm 1.0.1中存在一个错误,该错误确实可以正确汇总网络信息。已在此处修复,但截至撰写之时,它尚未发布。 p>

I currently have 3 EC2 instances setup with Docker Swarm and Consul. I have 3 simple node apps spread across all 3 instances, and then nginx for routing on my swarm master.

Using the guide for Overlay Networks, I've created a new overlay called mynetand have every container connected to this network. Using docker inspect I can confirm that each node container and the nginx container all are connected to mynet and have an IP. However, after sshing in to my nginx container, it's only able to communicate with the node app that sits on the same host through the network, and not the ones on the other hosts in the cluster.

After running docker network inspect mynet, only two of my containers are listed (the nginx and one node instance that were on the same host), while the other two aren't listed, even though they have the name and IPs for that overlay network from docker inspect.

The idea is using an nginx reverse proxy to add any new containers that come online to it's config, but am stuck on getting containers to all connect. According to the Docker networking docs for overlay this should possible.

What am I doing wrong? Thanks.

EDIT:

After spamming docker network inspect mynet a few times, it looks like containers are constantly connecting and disconnecting from the network, even though I have all firewalls off and ports opened for testing purposes. What would be causing something like that?

解决方案

Turns out there were two issues that's caused my problem.

One is I was using Kernel 3.13 which docker network overlay doesn't support. Upgrading to 3.16 fixed the issue. Second is there's a bug in Swarm 1.0.1 that does aggregate the network information correctly. It's been fixed here but as of time of writing it has not been released yet.

这篇关于Docker Swarm-网络覆盖未连接所有容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆