简体   繁体   English

init docker swarm with docker machine: context deadline exceeded

[英]init docker swarm with docker machine: context deadline exceeded

I'm learing Docker machine while encount some problems.
My computer is mac and use Docker for mac. I create 2 vm,vm1& vm2 by docker-machine,and try to init a swarm who has nodes-vm1,vm2 and my mac.My steps are below:
1. create an image called "sprinla/cms:latest" and a docker-compose.yml

version: "3"
services:
  web:
    image: sprinla/cms:latest
    deploy:
      replicas: 1
    ports:
      - "80:80"
    networks:
      - webnet
    command: /data/start.sh
networks:
  webnet:

2.create 2 vms.Here is vm info:

yuxrdeMBP:~ yuxr$ docker-machine ls  
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM   DOCKER        ERRORS  
vm1    -        virtualbox   Running   tcp://192.168.99.100:2376           v17.12.0-ce  
vm2    -        virtualbox   Running   tcp://192.168.99.101:2376           v17.12.0-ce  
  1. init swarm on my mac host:
yuxrdeMBP:~ yuxr$ docker swarm init
Swarm initialized: current node (uf6rg1v91exlwntlskyj8iim7) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join --token SWMTKN-1-3qb32l84n0s8vl74rj9d6psm7bzdany3piw55ohtrq0q7ly814-c5km5zg3kj9d6vn6vrtt6xxtg 192.168.65.2:2377
To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

4 join vm1 to swarm,then comes the problem

yuxrdeMBP:~ yuxr$ docker-machine ssh vm1 "docker swarm join --token SWMTKN-1-3qb32l84n0s8vl74rj9d6psm7bzdany3piw55ohtrq0q7ly814-c5km5zg3kj9d6vn6vrtt6xxtg 192.168.65.2:2377"
Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node.
exit status 1

5.cat the docker log :

time="2018-01-03T17:13:50.387854642Z" level=debug msg="Calling GET /_ping"
time="2018-01-03T17:13:50.388228524Z" level=debug msg="Calling GET /_ping"
time="2018-01-03T17:13:50.388521374Z" level=debug msg="Calling POST /v1.35/swarm/join"
time="2018-01-03T17:13:50.388583426Z" level=debug msg="form data: {\"AdvertiseAddr\":\"\",\"Availability\":\"\",\"DataPathAddr\":\"\",\"JoinToken\":\"*****\",\"ListenAddr\":\"0.0.0.0:2377\",\"RemoteAddrs\":[\"192.168.65.2:2377\"]}"
time="2018-01-03T17:13:55.392578452Z" level=error msg="failed to retrieve remote root CA certificate" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded" module=node
time="2018-01-03T17:14:02.394608777Z" level=error msg="failed to retrieve remote root CA certificate" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded" module=node
time="2018-01-03T17:14:09.395720474Z" level=error msg="failed to retrieve remote root CA certificate" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded" module=node
time="2018-01-03T17:14:10.393743738Z" level=error msg="Handler for POST /v1.35/swarm/join returned error: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the \"docker info\" command to see the current swarm status of your node."
time="2018-01-03T17:14:16.398095265Z" level=error msg="failed to retrieve remote root CA certificate" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded" module=node
time="2018-01-03T17:14:23.399587783Z" level=error msg="failed to retrieve remote root CA certificate" error="rpc error: code = DeadlineExceeded desc = context deadline exceeded" module=node
time="2018-01-03T17:14:25.399943337Z" level=error msg="cluster exited with error: rpc error: code = DeadlineExceeded desc = context deadline exceeded"
  1. below is my mac ifconfig info:

    yuxrdeMBP:~ yuxr$ ifconfig
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
      options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
      inet 127.0.0.1 netmask 0xff000000
      inet6 ::1 prefixlen 128
      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
      nd6 options=201<PERFORMNUD,DAD>
    gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
    stf0: flags=0<> mtu 1280
    XHC20: flags=0<> mtu 0
    en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
      ether ac:bc:32:81:97:37
      inet6 fe80::4d8:6b2:718a:5d3b%en0 prefixlen 64 secured scopeid 0x5
      inet 192.168.199.169 netmask 0xffffff00 broadcast 192.168.199.255
      nd6 options=201<PERFORMNUD,DAD>
      media: autoselect
      status: active
    p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
      ether 0e:bc:32:81:97:37
      media: autoselect
      status: inactive
    awdl0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1484
      ether 36:9f:65:fd:34:c3
      inet6 fe80::349f:65ff:fefd:34c3%awdl0 prefixlen 64 scopeid 0x7
      nd6 options=201<PERFORMNUD,DAD>
      media: autoselect
      status: active
    en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
      options=60<TSO4,TSO6>
      ether 6a:00:00:e3:4c:30
      media: autoselect <full-duplex>
      status: inactive
    en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
      options=60<TSO4,TSO6>
      ether 6a:00:00:e3:4c:31
      media: autoselect <full-duplex>
      status: inactive
    bridge0: flags=8822<BROADCAST,SMART,SIMPLEX,MULTICAST> mtu 1500
      options=63<RXCSUM,TXCSUM,TSO4,TSO6>
      ether 6a:00:00:e3:4c:30
      Configuration:
          id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
          maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
          root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
          ipfilter disabled flags 0x2
      member: en1 flags=3<LEARNING,DISCOVER>
              ifmaxaddr 0 port 8 priority 0 path cost 0
      member: en2 flags=3<LEARNING,DISCOVER>
              ifmaxaddr 0 port 9 priority 0 path cost 0
      media: <unknown type>
      status: inactive
    utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 2000
      options=6403<RXCSUM,TXCSUM,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
      inet6 fe80::441e:c0e3:5429:2abb%utun0 prefixlen 64 scopeid 0xb
      nd6 options=201<PERFORMNUD,DAD>
    utun1: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
      options=6403<RXCSUM,TXCSUM,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
      inet6 fe80::7820:5bac:4735:7f82%utun1 prefixlen 64 scopeid 0xc
      inet6 fd44:5cb3:4ab4:5d08:7820:5bac:4735:7f82 prefixlen 64
      nd6 options=201<PERFORMNUD,DAD>
    utun2: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1380
      options=6403<RXCSUM,TXCSUM,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM>
      inet6 fe80::26f2:e964:8dfb:e884%utun2 prefixlen 64 scopeid 0xd
      nd6 options=201<PERFORMNUD,DAD>
    gpd0: flags=8862<BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1400
      ether 02:50:41:00:01:01
    vboxnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
      ether 0a:00:27:00:00:00
      inet 192.168.99.1 netmask 0xffffff00 broadcast 192.168.99.255
    

Why????
mac host has ip, 192.168.99.1 ,vm1 has ip 192.168.99.100,vm2 has ip 192.168.99.101,they are in the same network,why can't vm1 nor vm2 join the mac host's swarm?

ANOTHER QUESTION:if i use vm1 as swarm manager,run "docker swarm join" commad on the mac host,when join as worker,it can join but can't use;when join as manager will has error:

yuxrdeMBP:~ yuxr$ docker swarm join --token SWMTKN-1-49w1hd28hs1mtj3sgmd0o3q7n59zgppvd18vs0iwhcnjemzmwb-7mk35zdnaslt1p41gninvwlud 192.168.99.100:2377
Error response from daemon: manager stopped: can't initialize raft node: rpc error: code = Unknown desc = could not connect to prospective new cluster member using its advertised address: rpc error: code = Unavailable desc = grpc: the connection is unavailable

THANK YOU FOR HELP ME !!!

There is no routing between the Mac host and Docker for Mac. Mac主机和Mac的Docker之间没有路由。 So on a Mac you can only setup multi-node swarms between VMs , and the standard Docker for Mac cannot participate in a multi-node swam .所以在 Mac 上只能在 VM 之间设置多节点 swarm,而 Mac 的标准 Docker不能参与多节点 swam This is a limitation on how networking is implemented on OSX.这是对如何在 OSX 上实现网络的限制。

See the documentation , where this is explained.请参阅文档,其中对此进行了解释。 Also see this issue for more background.另请参阅此问题以获取更多背景信息。

For Me, this error got resolved by making the Security groups to Inbound Rules to All traffic in AWS.对我来说,通过将安全组设置为 AWS 中的所有流量的入站规则来解决此错误。

I got the same error when trying to join a swarm cluster as a worker Used 2 VMs from Google cloud for this..

Manager node was working fine ..docker info--> swarm did not give any errors. but when i try to join the worker nodes with the token .. i got this error "Error response from daemon: Timeout was reached before node joined. The attempt to join the swarm will continue in the background. Use the "docker info" command to see the current swarm status of your node. " while docker info showed me "rpc error: code = DeadlineExceeded desc = context deadline exceeded in swarm error"

tried a lot of different things finally below solution worked.

solution. -->. i used "docker swarm init --force-new-cluster". in one of the vms i tried to join the as a worker.. and then i used "docker swarm leave --force" on the existing manager node .. and the joined that one as a worker to the newly created cluster. Other vm also also worked when tried to join as workers for the new cluster..

ubuntu - 18.04 docker version -20.10.17

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Docker swarm leave --force - 超出上下文截止日期 - Docker swarm leave --force - context deadline exceeded Docker 错误“无法连接到网络<name> : 超出上下文最后期限。”</name> - Docker error “Could not attach to network <name>: context deadline exceeded.” docker swarm init 的反义词是什么? - What is opposite of docker swarm init? 如何使用领事初始化Docker群 - How to init docker swarm with consul Docker 1.12中的单机Swarm - Single machine Swarm in Docker 1.12 docker run swarm create vs docker swarm init - docker run swarm create vs docker swarm init 在不使用docker机器的情况下部署docker swarm - Deploying docker swarm without using docker machine 上下文截止日期已延长-prometheus-在docker上运行时 - context deadline extended - prometheus - while running on docker (Kubernetes + Docker)Skaffold 不断终止我的部署文件:错误:无法在 2m0s 内稳定:超出上下文期限 - (Kubernetes + Docker) Skaffold keeps terminating my deployment files : Error: could not stabilize within 2m0s: context deadline exceeded 拉取镜像“docker4nitin/tg_bot:v2”失败:rpc 错误:code = Unknown desc = context deadline exceeded - Failed to pull image "docker4nitin/tg_bot:v2": rpc error: code = Unknown desc = context deadline exceeded
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM