Sergiy
Sergiy

Reputation: 2041

Consul and Docker connection issue

I tried to run Consul agents as Docker containers following this official guide: https://hub.docker.com/_/consul/

First agent started successfully: docker run -d --name=dev-consul consul

However when I launch command docker run -d consul agent -dev -join=172.17.0.2 the second agent stopped with error:

==> Starting Consul agent...
==> Joining cluster...
==> 1 error(s) occurred:

* Failed to join 172.17.0.2: dial tcp 172.17.0.2:8301: i/o timeout

I checked that first container ip is 172.17.0.2. My Docker version is 17.06.2-ce, build cec0b72. Consul version 0.9.3

Please advise.

Upvotes: 0

Views: 682

Answers (1)

264nm
264nm

Reputation: 755

Yeah I don't think that's going to work with new versions of docker-machine and current versions of consul.

You're not the only one who's had issues looking at the comments, and also trying myself (with the same versions of everything).

Try just starting a server and a couple client containers.

docker run -d --name=node0 consul agent -server -client=0.0.0.0 -node=node0 -bootstrap-expect=1 -bind=172.17.0.2 -data-dir=/tmp/consul
docker run -d --name=node1 consul agent -client=0.0.0.0 -node=node1 -bind=172.17.0.3 -data-dir=/tmp/consul -join=172.17.0.2
docker run -d --name=node1 consul agent -client=0.0.0.0 -node=node2 -bind=172.17.0.4 -data-dir=/tmp/consul -join=172.17.0.2

Honestly there is not much point running in that 'dev' mode anyway.

Upvotes: 1

Related Questions