我用过这个:
https://github.com/Mashape/docker-kong/tree/master/compose
通过docker compose在Docker上运行本地Kong。运行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
我在Google上搜索过,但我没有找到任何具体的答案。
答案 0 :(得分:1)
这种情况正在发生,因为领事'硬编码'它的初始分配的本地IP(172.17 ....),然后当你再次运行docker-compose时,它需要一个新的IP,所以它会让我们的朋友consul
感到困惑。
因此,作为简单的解决方法,您可以docker-compose rm consul
然后重新开始docker-compose up
。但请记住,您可能会丢失领事数据(即Key / Value商店,但我不知道您的申请是否正在使用它)
作为一种更好的解决方法(它为我工作),添加-client=0.0.0.0
告诉领事更好地硬编码。
在docker-compose.yml中:
consul:
image: progrium/consul:latest
command: -server -bootstrap -ui-dir /ui -client=0.0.0.0