SRV record lookups fail when using docker-compose

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.


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)


version: '2'
    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"
  2. See the error: “ 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" still works.

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
options ndots:0

In my non-compose container

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

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

I’ve created an issue for it ( but no response in over a week. I haven’t found a good workaround either.

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.

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.

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

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