Docker Community Forums

Share and learn in the Docker community.

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


(Nuclearjesus) #1


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: 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 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 ( 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 as dns which in turn will use the (or whatever, the consul it should be) as dns server.

I can’t find how this is specified? how to use a recursor in 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.