2017-05-29 171 views
0

我用這個:領事是無法找到簇頭

https://github.com/Mashape/docker-kong/tree/master/compose

本地的碼頭工人碼頭工人通過撰寫運行港。有一次,我跑docker-compose up我不斷地得到這個錯誤在我的日誌:

consul_1 | 2017/05/29 08:44:05 [INFO] raft: Node at 172.17.0.4:8300 [Candidate] entering Candidate state 
consul_1 | 2017/05/29 08:44:05 [ERR] raft: Failed to make RequestVote RPC to 172.17.0.3:8300: dial tcp 172.17.0.3:8300: connection refused 
consul_1 | 2017/05/29 08:44:05 [ERR] raft: Failed to make RequestVote RPC to 172.17.0.2:8300: dial tcp 172.17.0.2:8300: connection refused 
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader 
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader 
consul_1 | 2017/05/29 08:44:06 [ERR] agent: failed to sync changes: No cluster leader 

我搜索在谷歌,但我沒有發現任何具體的答案。

回答

1

發生這種情況是因爲consul'hardcode'其初始分配的本地IP(172.17 ....),那麼當您再次運行docker-compose時,需要一個新IP,因此它會讓我們的朋友consul感到困惑。

因此,作爲簡單的解決方法,您可以docker-compose rm consul並重新開始docker-compose up。但請記住,您可能會丟失領事數據(即Key/Value商店,但我不知道您的應用程序是否正在使用它)

作爲更好的解決方法(它適用於我),請將-client=0.0.0.0告訴領事強化一些更好的東西。

在泊塢窗,compose.yml:

consul: 
    image: progrium/consul:latest 
    command: -server -bootstrap -ui-dir /ui -client=0.0.0.0