5

I am quite new to Docker and Consul and now trying to set up a local Consul Cluster consisting of 3 dockerized nodes. I am using the progrium/consul Docker image and went through the whole tutorial and examples described.
The cluster works fine until it comes to restarting / rebooting.

Here is my docker-compose.yml:

--- node1: command: "-server -bootstrap-expect 3 -ui-dir /ui -advertise 10.67.203.217" image: progrium/consul ports: - "10.67.203.217:8300:8300" - "10.67.203.217:8400:8400" - "10.67.203.217:8500:8500" - "10.67.203.217:8301:8301" - "10.67.203.217:8302:8302" - "10.67.203.217:8301:8301/udp" - "10.67.203.217:8302:8302/udp" - "172.17.42.1:53:53/udp" restart: always node2: command: "-server -join 10.67.203.217" image: progrium/consul restart: always node3: command: "-server -join 10.67.203.217" image: progrium/consul restart: always registrator: command: "consul://10.67.203.217:8500" image: "progrium/registrator:latest" restart: always

I get message like:

[ERR] raft: Failed to make RequestVote RPC to 172.17.0.103:8300: dial tcp 172.17.0.103:8300: no route to host

which is obviously because of the new IP my nodes 2 and 3 get after the restart. So is it possible to prevent this? A read about linking and environment variables but it seems those variables are also not updated after a reboot.

4

1 回答 1

4

在我读到重新启动容器化领事节点时存在 ARP 表缓存问题之前,我遇到了同样的问题。

据我所知,有两种解决方法:

  1. 使用 --net=host 运行容器
  2. 在重新启动容器之前清除 ARP 表: docker run --net=host --privileged --rm cap10morgan/conntrack -F

所有者(Jeff Lindsay)告诉我,他们正在重新设计整个容器并内置此修复程序,不幸的是没有时间表。

来源:https ://github.com/progrium/docker-consul/issues/26

于 2015-05-08T08:24:41.947 回答