2

I'm trying to get started with docker swarm using etcd for the discovery backend. My etcd server is at etcd.programster.org (10.1.0.44) whilst my docker node is at swarm1.programster.org (10.1.0.47). All machines are running on Virtualbox instances on my local network (10.1.0.x).

I manage to get my etcd server running with the following:

MY_IP="10.1.0.44"

./etcd \
-name infra0 \
-initial-advertise-peer-urls http://$MY_IP:2380 \
-listen-peer-urls="http://0.0.0.0:2380,http://0.0.0.0:7001" \
-listen-client-urls="http://0.0.0.0:2379,http://0.0.0.0:4001" \
-advertise-client-urls="http://$MY_IP:2379" \
-initial-cluster-token etcd-cluster-1 \
-initial-cluster infra0=http://$MY_IP:2380 \
-initial-cluster-state new

I can set and retrieve key values from swarm1.programster.org just fine with curl and etcd.

# setting key with etcdctl
./etcdctl --peers http://etcd.programster.org:4001 set etc://etcd.programster.org/mykey "test"

# setting key with curl
curl -L \
http://etcd.programster.org:4001/v2/keys/mykey \
-XPUT -d value="test"

# retrieving key with etcdctl
./etcdctl --peers http://etcd.programster.org:4001 get etc://etcd.programster.org/mykey

# retrieving key with curl
curl -L http://etcd.programster.org:4001/v2/keys/mykey

However, whenever I run a swarm based command such as:

docker run swarm list etcd://10.1.0.44/

or

docker run swarm join --advertise=10.1.0.47:2375 etcd://10.1.0.44/

I always get the following error message:

[timestamp] client: etcd cluster is unavailable or misconfigured

Have I configured my etcd server incorrectly or perhaps there is a networking configuration that I need to perform on the docker node first? I have not performed any TLS authentication yet for simplicity but perhaps swarm will not work without this?

Context

  • All machines are running Debian 8 (3.16.0-4-amd64). Also tested with Ubuntu 14.04 for swarm1.programster.org.
  • Docker version 1.9.1, build a34a1d5
  • etcd version 2.2.2
4

1 回答 1

3

Try including the port number like this:

docker run swarm join --advertise=10.1.0.47:2375 etcd://10.1.0.44:2379/swarm

I had the same issue and I assumed docker would intelligently infer the port number from "etcd://" - I was wrong.

于 2016-01-21T00:12:35.467 回答