我正在尝试为consul创建一个容器,但输出总是失败,有趣的是,我真的不认为这是一个错误
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)以下是我正在使用的命令:
docker container run --net host --name consul-server -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' -e CONSUL_BIND_INTERFACE='eth0' consul agent -server -client 0.0.0.0 -dns-port 53 -bootstrap-expect 1 -ui -datacenter dc1 -v "/var/lib/consul:/consul/data" -data-dir /var/lib/consul它是单节点全新安装,具有注册表中的最新版本,因此这里不会发生任何代理/客户端的升级或版本不匹配问题。
发布于 2017-07-11 21:26:16
有两件事需要解决。首先,-v卷参数必须用于docker命令,而不是consul命令。将其移动到正确的位置:
docker container run -v "/consul/data:/var/lib/consul" -data-dir /var/lib/consul --net host --name consul-server -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' -e CONSUL_BIND_INTERFACE='eth0' consul agent -server -client 0.0.0.0 -dns-port 53 -bootstrap-expect 1 -ui -datacenter dc1 还要颠倒它们(它们是/host/dir:/container/dir)
第二,默认情况下,领事不能监听特权端口(即53)。请看这个:https://www.consul.io/docs/guides/forwarding.html,所以删除-dns-port 53并实现他们推荐的任何方法:
docker container run -v "/consul/data:/var/lib/consul" -data-dir /var/lib/consul --net host --name consul-server -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' -e CONSUL_BIND_INTERFACE='eth0' consul agent -server -client 0.0.0.0 -bootstrap-expect 1 -ui -datacenter dc1 我推荐DNSMasq setup,它很容易实现。
发布于 2017-07-12 13:43:38
@Robert Alright,我想我们也有点离题了。真正的问题是它显示的消息,并在那之后立即退出。
我尝试了你的例子,它给出了相同的消息/错误(但不要认为这是一个错误)
[root@ip-X-X-X-X user]# docker container run --net host --name consul-server -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' -e CONSUL_BIND_INTERFACE='eth0' consul agent -server -client 0.0.0.0 -dns-port 53 -bootstrap-expect 1 -ui -datacenter dc1 -v "/var/lib/consul:/consul/data" -data-dir /var/lib/consul
==> Found address 'X.X.X.X' for interface 'eth0', setting bind option...
Consul v0.8.5
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
[root@ip-X-X-X-X user]# docker container ls | grep consul-server
[root@ip-10-201-14-34 user]#递归函数示例也是如此:
[root@ip-X.X.X.X user]# docker container run --net host --name consul-server -e 'CONSUL_LOCAL_CONFIG={"skip_leave_on_interrupt": true}' -e CONSUL_BIND_INTERFACE='eth0' consul agent -server -client 0.0.0.0 -dns-port 53 -bootstrap-expect 1 -ui -datacenter dc1 -v "/var/lib/consul:/consul/data" -data-dir /var/lib/consul -recursers 8.8.8.8
==> Found address 'X.X.X.X' for interface 'eth0', setting bind option...
Consul v0.8.5
Protocol 2 spoken by default, understands 2 to 3 (agent will automatically use protocol >2 when speaking to compatible agents)
[root@ip-X-X-X-X user]# docker container ls | grep consul-server
[root@ip-10-201-14-34 user]#https://stackoverflow.com/questions/45035169
复制相似问题