# How does docker-compose example know where the other nodes are? (it uses \`localhost\`)

**URL:** <https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564>\
**Category:** ScyllaDB\
**Tags:** open-source\
**Created:** [May 20, 2023, 4:41pm UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564 "2023-05-20T16:41:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![danthegoodman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/danthegoodman1/32/314_2.png) [@danthegoodman1](https://forum.scylladb.com/u/danthegoodman1)\
**Post date:** [May 20, 2023, 4:41pm UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/1 "2023-05-20T16:41:46Z")

</div>

Following the example found at [scylla-code-samples/mms at master · scylladb/scylla-code-samples · GitHub](https://github.com/scylladb/scylla-code-samples/tree/master/mms) I see that the configuration used within the first cluster has:

```yaml
# Address or interface to bind to and tell other Scylla nodes to connect to.
# You _must_ change this if you want multiple nodes to be able to communicate!
#
# Setting listen_address to 0.0.0.0 is always wrong.
listen_address: localhost

# Address to broadcast to other Scylla nodes
# Leaving this blank will set it to the same value as listen_address
# broadcast_address: 1.2.3.4

```

Yet running `nodetool status` I see the cluster:

```auto
Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 172.24.0.2 920 KB 256 ? b71f2176-e8eb-4dd1-9c0a-dd06ccfe6c54 Rack1
UN 172.24.0.3 544 KB 256 ? 1781ddb4-2e36-48f2-b918-87dda29b8738 Rack1
UN 172.24.0.4 880 KB 256 ? d2b4d33b-8a02-429b-a7e3-83e7681b86b4 Rack1

```

Given that they are advertising `localhost`, I would assume they would not be able to connect to each other. I do see the seeds, but my assumption is that they wouldn’t be able to talk to each other like this for operations such as repairs and relaying queries.

How does `localhost` allow them to both listen and discover?

---

<div class="post-metadata">

**Author:** ![danthegoodman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/danthegoodman1/32/314_2.png) [@danthegoodman1](https://forum.scylladb.com/u/danthegoodman1)\
**Post date:** [May 20, 2023, 4:49pm UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/2 "2023-05-20T16:49:04Z")

</div>

Is this just some docker networking magic?

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [May 22, 2023, 9:22am UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/4 "2023-05-22T09:22:12Z")

</div>

In the [docker-compose of the MMS example](https://github.com/scylladb/scylla-code-samples/blob/master/mms/docker-compose.yml), the nodes use a bridge network to allow the containers to communicate.  
The seed nodes are defined with an IP address, which allows them to discover each other.  
You can read more about running ScyllaDB on Docker [here](https://docs.scylladb.com/stable/operating-scylla/procedures/tips/best-practices-scylla-on-docker.html).

---

<div class="post-metadata">

**Author:** ![danthegoodman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/danthegoodman1/32/314_2.png) [@danthegoodman1](https://forum.scylladb.com/u/danthegoodman1)\
**Post date:** [May 22, 2023, 10:55am UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/5 "2023-05-22T10:55:15Z")

</div>

I guess I’m wondering why it’s not trying to use local host despite it advertising that as default, but instead overrides and uses the docker ip.

---

<div class="post-metadata">

**Author:** ![Guy](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/guy/32/9_2.png) [@Guy](https://forum.scylladb.com/u/Guy)\
**Post date:** [May 23, 2023, 10:39am UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/6 "2023-05-23T10:39:24Z")

</div>

Generally, using the command line flags overwrites scylla.yaml settings.  
In this case, the seed nodes are provided when starting Docker, and that’s how they find each other.  
The listen\_address setting for the node sets the address or interface to bind to and tells other Scylla nodes how to connect to the node.

---

<div class="post-metadata">

**Author:** ![danthegoodman1](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/danthegoodman1/32/314_2.png) [@danthegoodman1](https://forum.scylladb.com/u/danthegoodman1)\
**Post date:** [May 23, 2023, 11:30am UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/7 "2023-05-23T11:30:21Z")

</div>

The listen\_address is still local host though, it’s not being overridden by a flag. My questions is more how that works but it’s not a burning one. Asking others apparently Docker can resolve that to the containers ip within the network, but not sure if that’s true

---

<div class="post-metadata">

**Author:** ![Israel\_Fruchter](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/israel_fruchter/32/153_2.png) [@Israel\_Fruchter](https://forum.scylladb.com/u/Israel_Fruchter)\
**Post date:** [May 24, 2023, 2:27pm UTC](https://forum.scylladb.com/t/how-does-docker-compose-example-know-where-the-other-nodes-are-it-uses-localhost/564/8 "2023-05-24T14:27:03Z")

</div>

@danthegoodman1  
it’s localhost since it’s using docker, each scylla is listen to it’s own localhost  
each docker instance has it’s own virtual network device  
when you configure each one to connect with the others it would be using the actually address, i.e. what set in the `broadcast_address`
