Docker Community Forums

Share and learn in the Docker community.

SRV record lookups fail when using docker-compose


(Kevin Le) #1

Expected behavior

SRV record lookups should work in docker-compose

Actual behavior

SRV record lookups fail in docker-compose. Curiously they still work when I run them through docker rather than docker-compose.

Information

Docker for Mac: version: win-v1.12.0-beta19
OS X: version 10.11.5 (build: 15F34)
logs: /tmp/20160714-131811.tar.gz
[OK] docker-cli
[OK] app
[OK] moby-syslog
[OK] virtualization
[OK] menubar
[OK] system
[OK] osxfs
[OK] db
[OK] slirp
[OK] moby-console
[OK] logs
[OK] vmnetd
[OK] env
[OK] moby
[OK] driver.amd64-linux

OS X 10.11.5 (15F34)

docker-compose.yml:

version: '2'
services:
  srv:
    image: ubuntu

Steps to reproduce the behavior

  1. docker-compose run srv /bin/bash -c "apt-get update; apt-get install -y dnsutils; host -t SRV _kerberos._udp.ox.ac.uk"
  2. See the error: “_kerberos._udp.ox.ac.uk has no SRV record”

Note that running docker run --rm -it ubuntu /bin/bash -c "apt-get update; apt-get install -y dnsutils; host -t SRV _kerberos._udp.ox.ac.uk" still works.


(Kevin Le) #2

Just noticed that my docker-compose container and docker container had different /etc/resolv.conf, in my docker-compose:

root@73bd4a3362a7:/# cat /etc/resolv.conf
search local
nameserver 127.0.0.11
options ndots:0

In my non-compose container

root@d6169cd23002:/# cat /etc/resolv.conf
search local
nameserver 192.168.65.1

(Estoro) #3

Did you determine a way to get around this? I am experiencing the same thing.


(Kevin Le) #4

I’ve created an issue for it (https://github.com/docker/for-mac/issues/209) but no response in over a week. I haven’t found a good workaround either.


(Estoro) #5

Reverting to docker compose v1 (while not optimal) is the temporary fix I am using. To my understanding the resolv.conf from v2 compose you have above is correct [1]. I am looking into that now and will post back if I figure out how that works.

[1] https://github.com/docker/compose/issues/2847
DNS is configured differently when using a custom network (as is the case when using v2 of the Compose file format), but the dns setting is still respected. From the Docker networking docs:
'The IP addresses passed via the --dns option is used by the embedded DNS server to forward the DNS query if embedded DNS server is unable to resolve a name resolution request from the containers. These --dns IP addresses are managed by the embedded DNS server and will not be updated in the container’s /etc/resolv.conf file.


(Kevin Le) #6

Issue is resolved for me as of Version 1.12.1-beta24 (build: 11508)


(Estoro) #7

+1 can confirm this is also working in docker for windows version 1.12.1-beta24 (build: 6563)