igr
igr

Reputation: 10624

How to access Consul used in Docker overlay networks?

I do have set the overlay multi-host network that uses Consul, without Swarm.

I want to access Consul for my own needs. When I run my docker infrastructure locally (on several docker machines), I can't reach it with:

consul members --rpc-addr=192.168.99.100:8500

This does not return anything. Port 8500 is the only exposed. I see 8300 (and bunch of other ports) is also open, but not exposed.

Should I expose 8300? Why Docker/VMs are using 8500?

Upvotes: 0

Views: 668

Answers (1)

Auzias
Auzias

Reputation: 3798

There are different ports used by consul.

  • 8500 is used to communicate with other consul agent.
  • 8400 is used to perform RPC with the consul agent bound to the ip address specified with the option -bind (local by default).

Hence the command:

consul agent -data-dir /tmp/consul -node=$HOSTNAME -bind=$IP

This would start a consul agent, named $HOSTNAME and bound to the IP address $IP, to which commands can be sent by commands such as consul members -rpc-addr=$IP:8400.


You may find this answer useful. It describes a step-by-step tutorial to run an multi-host overlay network with Swarm using Consul.


Edit

As pointed out by @vince-bowdren, the documentation give in depth details on the various udp/tcp ports used by consul.

Upvotes: 2

Related Questions