Docker Community Forums

Share and learn in the Docker community.

Docker with overlay network can't specify consul server as dns resolver

docker
dns

(Nuclearjesus) #1

Hi,

Inside my docker containers (no swarm or other orchestrator) I’d love to use the consul server (in container also) as dns server.
this works fine (by specifying dns: 172.17.0.1 in docker-compose file) as long as I run my containers without overlay network.

When I start using the overlay network then the resolv.conf of my containers becomes 127.0.0.11 which isn’t the consul so lot of functionality gets lost in my setup (load-balancers)

Ofcourse, when using an overlay network, I can no longer specify “networking bridged” so docker0 (172.17.0.1) is useless I suppose as dns server. However, this ip can still be pinged from within the containers.

So in the app container, I can manually specify the consul container (port is forwarded) as dns and then resolving the .service.consul records works again.
But then ofcourse, resolving docker-container names no longer works…

the obvious(? to me it is) solution would be to have a recursor and use the 127.0.0.11 as dns which in turn will use the 172.17.0.1 (or whatever, the consul it should be) as dns server.

I can’t find how this is specified? how to use a recursor in 127.0.0.11 which comes with the overlay networking?

thank you.

SOLVED ** I’m working on different compose files at the same host:
infra part
app part
infra part did NOT have the dns config correctly setup
app part did
so …

is right after all. :slight_smile:


(Nuclearjesus) #2

On a sidenote:

  • this is straight docker engine, not machine or anything like that
  • using docker-compose v2 files
  • docker version is 1.10 (but there’s also 1.11 in the other hosts)
  • the consul which holds my services (containers) is containerized
  • the consul which defines the overlay network is not the same as the containerized consul which holds my services.