来自守护程序的错误响应:连接到网络失败,请确保您的网络选项正确,并检查管理器日志:超出了上下文期限 [英] Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded
问题描述
我正在尝试使用覆盖网络设置docker swarm.我在aws上有一些主机,而另一些是运行Ubuntu的笔记本电脑(与aws相同).每个节点都有一个静态的公共IP.我创建了一个覆盖网络,如下所示: docker network create --driver = overlay --attachable test-net
I am trying to set up docker swarm with an overlay network. I have some hosts on aws while others are laptops running Ubuntu(same as on aws). Every node has a static public IP. I have created an overlay network as:
docker network create --driver=overlay --attachable test-net
我在aws主机之一上创建了一个群集网络.每个其他节点都可以加入该群集网络.
I have created a swarm network on one of the aws hosts. Every other node is able to join that swarm network.
但是,当我在不在aws上的任何节点上运行 docker run -it --name alpine2 --network test-net alpine
时,出现错误: docker:来自守护程序的错误响应:连接到网络失败,请确保您的网络选项正确,并检查管理器日志:上下文期限已过.
However when I run docker run -it --name alpine2 --network test-net alpine
on any node not on aws, I get the error: docker: Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded.
但是,如果我在任何aws主机上运行相同的命令,则一切工作正常.在网络/端口方面,如果aws上有一些节点而其他节点上没有,我还需要做更多的事情吗?
But if I run the same on any aws host, then everything is working fine. Is there anything more I need to do in terms of networking/ports If there are some nodes on aws while others are not?
我打开了所有计算机上群联网所需的端口.
I have opened the ports required for swarm networking on all machines.
编辑:在管理器节点中列出时,所有节点都标记为活动".
EDIT: All the nodes are marked as "active" when listing in the manager node.
更新通过打开相应的端口解决了此问题.现在,如果所有节点都基于Linux,则可以使用.但是,当我尝试以Linux(ubuntu)操作系统与管理器建立群时,mac os机器无法加入该群.
UPDATE Solved this issue by opening the respective ports. It now works if all the nodes are Linux based. But when I try to make a swarm with the manager as Linux(ubuntu) os, mac os machines are not able to join the swarm.
推荐答案
检查以下端口是否在两台计算机上均已打开.
Check if the below ports are opened on both machines.
- TCP 端口
2377
- TCP 和 UDP 端口
7946
- UDP 端口
4789
- TCP port
2377
- TCP and UDP port
7946
- UDP port
4789
您可以使用 ufw
允许端口:
ufw allow 2377/tcp
这篇关于来自守护程序的错误响应:连接到网络失败,请确保您的网络选项正确,并检查管理器日志:超出了上下文期限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!