简体   繁体   中英

Error response from daemon: attaching to network failed, make sure your network options are correct and check manager logs: context deadline exceeded

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

I have created a swarm network on one of the aws hosts. Every other node is able to join that swarm network.

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.

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.

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 node in drain state:

docker node inspect --format {{.Spec.Availability}} node

if yes then update the state:

docker node update --availability active node

here is the explanation:

Resolution

When a node is in drain state, it is expected behavior that you should not be able to allocate swarm mode resources such as multi-host overlay network IP addresses to the node.However, swarm mode does not currently provide a messaging mechanism between the swarm leader where IP address management occurs back to the worker node that requested the IP address. So docker run fails with context deadline exceeded. Internal engineering issue escalation/292 has been opened to provide a better error message in a future release of the Docker daemon.

source

Check if the below ports are opened on both machines.

  • TCP port 2377
  • TCP and UDP port 7946
  • UDP port 4789

You may use ufw to allow the ports:

ufw allow 2377/tcp

我有一个类似的问题,设法通过确保节点的引擎版本相同来修复它。

sudo docker node ls

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