2

I'm configuring some databases in a swarm cluster environment to use endpoint-mode = dnsrr

Documentation says (https://docs.docker.com/network/overlay/):

"A DNS query for the service name on the Docker host returns a list of IP addresses for the nodes running the service"

I'm having trouble to understand what this sentence is saying.

If I use dig to query the service name, which dns server which I have to use?. Swarm manager (which I understand as docker host) is not running a DNS server as I know.

What I do know is that inside an overlay network you can resolve using tasks.$servicename, but for dnsrr and host network, how it is done?

PRF
  • 141
  • 2

1 Answers1

0

I agree the docs aren't full clear on this point, but on the following example, I have composed a service with two containers replicas:

  webx:
    restart: on-failure
    build: ./web
    hostname: webx
    deploy:
        replicas: 2
        endpoint_mode: dnsrr

Then, opening the console and running a nslookup using the service name, I understand that Docker is internally handling the service name "webx" as a DNS, and when I open network connections from another container to webx, it does the round robin behavior.

# nslookup webx
Server:         127.0.0.11
Address:        127.0.0.11#53

Non-authoritative answer:
Name:   webx
Address: 172.20.0.6
Name:   webx
Address: 172.20.0.5