2016-08-01 62 views
2

Manager版本Docker version 1.12.0-rc5, build a3f2063Docker1.12工人無法在集羣加入(羣:待定)

工人版本Docker version 1.12.0-rc5, build a3f2063

創建羣經理:在工人

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,我看到了 「羣:待定」

我也做過docker swarm update也!但是,該工作人員無法加入羣集。所以,我怎麼能reslove

UPDATE-1

卸載&刪除配置文件,然後安裝搬運工1.12再次Docker version 1.12.0, build 8eab29e版本。

仍然面臨着同樣的問題(無法加入和「羣:待定」在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." 

感謝。

+3

顯然,我有同樣的問題。對我來說,解決方案是確定工人的日期。要清楚的是,工人的日期不對(舊日期)。我讓工作人員使用NTP服務器,並解決了問題(我猜)。我不是把它寫成解決方案,因爲我不完全理解發生了什麼。我只知道它對我有用。 –

+1

有同樣的問題。可能是因爲生成的令牌(加入羣集)取決於時間。 – lvthillo

+1

我有同樣的問題。 @ IntiGonzalez-Herrera提到的日期/時間是解決方案。由於某些防火牆問題,我無法設置NTP服務器,但想象一下,我至少可以使用NTP將我所有的工作人員同步到管理員。我用於測試swarm的一個快速解決方案是將時間與date --set =「$(ssh user @ server date)」同步「 –

回答

3

事情是,我試圖加入錯誤的「端口」(如輸出中顯示的docker swarm init)。

1)在「docker swarm init」之前,docker只在端口「4243」上運行。我檢查了netstat -tulp | grep docker。所以我宣傳了那個港口!

[email protected]:~# netstat -tulpn | grep docker 
tcp6  0  0 :::4243     :::*     LISTEN  8750/dockerd 

[email protected]:~# 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後,搬運工用4端口包括端口2377netstat -tupln | grep docker)上運行。

[email protected]:~# 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點,它是告訴與端口4243在工作運行docker swarm join。 (它不會工作!)

後來我做了docker swarm leave並加入了端口。現在我可以加入!

docker swarm join --token SWMTKN-1-5j9mpo8hepue6g1sjdas33thr92w1o9hlef5auwqpbxs3glt39-6zomhgu204m9alq51f632nzas 172.25.30.2:2377 
1

我正面臨類似的問題,而在我的情況下,由於防火牆規則,端口被阻止。

+0

我知道你是一個新用戶,所以你不能評論而不是回答,但是當提供一個答案請提供一個你找到的詳細解決方案,以防其他人偶然發現你解決的同一個問題。請參閱[如何回答](https://stackoverflow.com/help/how-to-answer)。 –

+0

謝謝,我試過其他解決方案,我的問題歸結爲此。只要我打開防火牆一切正常。 – Luke101

+0

通過刷新iptables解決 – AJN

0

我遇到了同樣的問題。我在Azure中運行coreos vms。我發現我所有的vms都有相同的私有ip地址和不同的公共ip地址。當vms是同一安全組的一部分時,通常會發生這種情況,但這次不是這種情況。問題是我的帳戶已達到最大資源數量,所以我刪除了諸如IP地址,nsg,網絡等資源,然後重新配置了新的vms,它們擁有不同的私有ip,並且在運行命令時一切正常。我的碼頭版本是1.12.6

0

對我來說這是一個防火牆問題。

  1. 我試圖平到管理器節點,並查驗回

  2. 經過,如果端口使用telnet打開,是無法連接,並計算出它的端口號。

如果你正在運行的Centos比端口可以使用firewalld

檢查可以輕鬆打開,如果firewalld運行

sudo firewall-cmd --state 

打開的端口,你想

sudo firewall-cmd --zone=public --add-port=2377/tcp 

根據您嘗試連接的節點端口更改端口。