经理版本Docker version 1.12.0-rc5, build a3f2063
,
工人版Docker version 1.12.0-rc5, build a3f2063
。
创建了Swarm manger:
docker swarm init --advertise-addr "172.25.30.2:4243"
Swarm initialized: current node (3kmewyb10p8xj3ke5rpjyw4s8) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq \
172.25.30.2:4243
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-85cwe5pf779qw0knjn6wxdbim \
172.25.30.2:4243
然后创建工人
docker swarm join --token SWMTKN-1-5lwzvv7au6hosiqqmdwmcxvmlmhtz4ts04jsg06284fq3posn0-enq26dqnwma38ij48hymtnioq 172.25.30.2:4243
Error response from daemon: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use "docker info" command to see the current swarm status of your node.
我检查了工作日志
time="2016-08-01T00:22:47.449844174-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:22:47.449962215-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:22:47.450025342-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:22:47.450081950-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:22:47.450142443-07:00" level=warning msg="failed to retrieve remote root CA certificate: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:22:47.450202836-07:00" level=error msg="cluster exited with error: rpc error: code = 1 desc = context canceled"
time="2016-08-01T00:23:31.351868722-07:00" level=error msg="Handler for POST /v1.24/swarm/join returned error: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use \"docker info\" command to see the current swarm status of your node."
在docker info
中,我看到了#34; Swarm:Pending"
我也做了docker swarm update
!但是,工作人员无法加入群集。那么,我怎样才能重新开始
UPDATE-1
已卸载&删除配置文件,然后使用版本Docker version 1.12.0, build 8eab29e
再次安装docker 1.12。
仍然面临同样的问题(无法加入" Swarm:待定"在docker info
中)/var/logs/upstat/docker.logs
time="2016-08-01T11:22:08.629760770-07:00" level=error msg="Handler for POST /v1.24/swarm/join returned error: Timeout was reached before node was joined. Attempt to join the cluster will continue in the background. Use \"docker info\" command to see the current swarm status of your node."
感谢。
答案 0 :(得分:6)
问题是,我试图加入错误的“端口”(输出中显示为docker swarm init
)。
1)在“docker swarm init”之前,docker仅在端口“4243”上运行。我已与netstat -tulp | grep docker
核实过了。所以我用那个端口做广告!
root@veeru:~# netstat -tulpn | grep docker
tcp6 0 0 :::4243 :::* LISTEN 8750/dockerd
root@veeru:~# docker swarm init --advertise-addr "172.25.30.2:4243"
Swarm initialized: current node (exvwgj0pu4cd124ljnblt9xff) is now a manager.
To add a worker to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-6zomhgu204m9alq51f632nzas \
172.25.30.2:4243
To add a manager to this swarm, run the following command:
docker swarm join \
--token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-axhgqgo4jqw4hv38x578m44wh \
172.25.30.2:4243
2)在docker swarm init
之后,docker正在运行4端口,包括端口2377
(netstat -tupln | grep docker
)。
root@veeru:~# netstat -tulp | grep docker
tcp6 0 0 [::]:2377 [::]:* LISTEN 8750/dockerd
tcp6 0 0 [::]:7946 [::]:* LISTEN 8750/dockerd
tcp6 0 0 [::]:4243 [::]:* LISTEN 8750/dockerd
udp6 0 0 [::]:7946 [::]:* 8750/dockerd
在第1点中,它告诉我在worker中运行docker swarm join
端口4243
。以前我确实跑过!(它不会工作!)
后来我做了docker swarm leave
并加入了端口 2377 。现在我可以加入了!
docker swarm join --token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-6zomhgu204m9alq51f632nzas 172.25.30.2:2377
答案 1 :(得分:2)
对我来说,这也是一个防火墙问题。
我尝试ping到管理器节点并正在回来
检查端口是否使用telnet打开并且无法连接并发现它是端口问题。
如果您正在运行Centos,则可以使用firewalld轻松打开端口
检查firewalld是否正在运行
sudo firewall-cmd --state
打开您想要的端口
sudo firewall-cmd --zone=public --add-port=2377/tcp
根据尝试连接的节点端口更改端口。
答案 2 :(得分:1)
我遇到了类似的问题,而在我的情况下,端口因防火墙规则而被阻止。
答案 3 :(得分:1)
我遇到了同样的问题。我在Azure中运行coreos vms。我发现我所有的vms都有相同的私有IP地址和不同的公共IP地址。这通常发生在vms是同一安全组的一部分时,但这次不是这种情况。问题是我的帐户已达到最大资源数,所以我删除了ip地址,nsg,网络等资源,然后重新配置了新的vms,他们有不同的私有ips,当运行命令时一切都很好。我的泊坞版版本是1.12.6
答案 4 :(得分:0)
只需暴露管理器的2377端口,它就可以工作。
这显然意味着节点无法连接管理器,因此恰好符合超时要求只需 telnet manager-ip 2377 (不要尝试ping,将无法正常工作。)
如果即使在节点和管理器都禁用了所有防火墙的情况下仍然遇到相同的错误,请尝试创建另一个管理器,暴露端口2377,如下所示:
docker-machine create --driver amazonec2 --amazonec2-open-port 2377 manager1
现在尝试将节点加入到现在创建的新管理器中,但是如果要使用diff然后在上面的命令中公开该端口,则您要加入的端口应为2377。我怀疑这样做对我有用,因为其他人使用了其他不同的服务器,但我在管理器和节点上都使用了同一服务器。
答案 5 :(得分:0)
根据dockers网站Here,他们声明了要启用的端口。 在Swam Manager和辅助节点上运行以下命令
sudo ufw enable
sudo ufw allow 22/tcp
sudo ufw allow 2376/tcp
sudo ufw allow 2377/tcp
sudo ufw allow 7946/tcp
sudo ufw allow 7946/udp
sudo ufw allow 4789/udp
sudo ufw reload
我们刚刚进入了必要的港口。运行完这些命令后,所有docker命令现在都应该可以使用。