I am new to cluster. I can not see the difference between these two options? I think the advertise addr is used by other nodes to communicate with each other and listen addr is used by hosts to join in cluster. So I think these two addr will always be the same. Am I right?
Leaving --listen-addr
at it's default 0.0.0.0:2377 tells it to listen on all interfaces for requests. You can use this to limit Swarm to only listen on specific interfaces if you have something like a management network that's separate from a public network on your nodes.
The --advertise-addr
is the address given out to other nodes in the Swarm for establishing connections and needs to be an address everyone can resolve and reach.
Note that early RC's of 1.12 didn't have --advertise-addr
so you may find some instructions indicating --listen-addr
should be used. I'd disregard those and use --advertise-addr
only unless you have a specific use case.
You are correct, also listen addr is the address which the daemon will be accepting connections, ie. 0.0.0.0:<port>
means the daemon is reachable from all possible ip addr. While 192.168.1.1:<port>
means the daemon will only accept connections on that specific interface.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With