docker swarm init无法选择IP地址错误 [英] docker swarm init could not choose an IP address error

查看:1765
本文介绍了docker swarm init无法选择IP地址错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  docker-machine create -d virtualbox node-1 
docker-machine create -d virtualbox node-2
docker-machine create -d virtualbox node-3

eval $(docker-machine env node-1)

docker swarm init \
--secret my-secret \
--auto-accept worker \
--listen-addr $(docker-machine ip node-1): 2377

最后一个命令(docker swarm init)返回此错误,在Google上无法找到:

 守护进程错误响应:无法选择要发布的IP地址,因为该系统有多个地址

我不知道发生了什么。任何人都有任何想法如何调试?谢谢!

解决方案

更新2017-05-24:



之前的答案是早期状态的群模式。秘密和自动接受选项已被删除,并且已添加了advertise-addr选项。现在可以这样做:

  docker swarm init \ 
--advertise-addr $(docker-machine ip node-1)

端口默认为2377.您还可以使用网络接口名称的IP地址和群组将查找该接口上的IP地址。监听器地址仍然是一个选项,但默认是在所有接口上进行监听,这通常是首选解决方案。






原始答案:



我还没有使用docker-machine,但是我知道新的群组对条目非常敏感在/ etc / hosts中。确保您的ip和主机名在该文件中,并且只在一个地方(也不映射到环回或任何其他内部地址)。从RC3开始,他们也使用侦听器地址做广告地址,所以确保这个主机名或者ip可以被群集中的所有节点引用(很确定一个修复是为了这个,如果还没有在这里)。



为了最大限度地减少客户端和服务器版本之间的问题风险,我还可以直接在虚拟机中运行命令,而不是使用docker-machine环境变量。 p>

Experimenting with Docker Swarm and I did this:

docker-machine create -d virtualbox node-1
docker-machine create -d virtualbox node-2
docker-machine create -d virtualbox node-3

eval $(docker-machine env node-1)

docker swarm init \
    --secret my-secret \
    --auto-accept worker \
    --listen-addr $(docker-machine ip node-1):2377

The last command (docker swarm init) returns this error, which is nowhere to be found on Google:

Error response from daemon: could not choose an IP address to advertise since this system has multiple addresses

I have no idea what's going on. Anyone have any idea how to debug? Thanks!

解决方案

Update 2017-05-24:

The prior answer was for an early state of swarm mode. The secret and auto-accept options have since been removed, and the advertise-addr option has been added. This can now by done with:

docker swarm init \
  --advertise-addr $(docker-machine ip node-1)

The port will default to 2377. You can also use a network interface name instead of an IP address and swarm will lookup the IP address on that interface. The listener address is still an option but the default is to listen on all interfaces which is typically the preferred solution.


Original answer:

I haven't done this with docker-machine yet, but I do know that the new swarm is very sensitive to the entries in /etc/hosts. Make sure your ip and hostname are in that file, and only in a single place (not also mapped to loopback or any other internal addresses). As of RC3, they are also using the listener address for the advertise address, too, so make sure this hostname or ip can be referenced by all nodes in the swarm (pretty sure a fix is coming for that, if not already here).

To minimize the risk of issues between client and server versions, I'd also run the commands directly inside the virtualbox, rather than with docker-machine environment variables.

这篇关于docker swarm init无法选择IP地址错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆