5

I'm using Docker for Mac v 1.12.3, the problem I am having is that that HTTP and HTTPS connections are very slow. DNS and Ping seem fine but HTTP(S) takes for example 5 seconds on the docker image but 0.05 seconds on the host:

Host (MacOS Sierra):
time curl www.google.com
0.05 real 
0.00 user 
0.00 sys

Docker:
time curl www.google.com
real 0m5.615s
user 0m0.010s
sys 0m0.000s

I can't see any reason for this or any other people with the same issue.

Any ideas?

  • 1
    Adding a valid nameserver to the top of the list in /etc/resolv.conf seems to have fixed it for me. Not sure why a valid DNS is not in this list. Still trying to see if one can be passed to Docker for Mac or HyperKit. – Spencer K Nov 29 '16 at 18:18
4

I noticed that /etc/resolv.conf had 10 different nameserver entries (similar to 192.168.65.1). Adding Google's DNS before any of those got rid of all the lag.

UPDATE: You might find (as I did) that the change via the moby debian host (below), doesn't actually persist across restarts. I found that v1.12.3 of Docker for Mac does now, however, respect both the --dns flag for the run command, as well as the dns property in a compose file. If you use the --dns flag, you don't need to modify any resolv.conf with the flag, it will override all the nameserver entries for you.

Doing further digging revealed that I needed to login to the moby image to modify the defaults. You can confirm this by looking at the resolv.conf of any of the images you've built. If they don't have a known-DNS, then you need to follow the directions here:

https://github.com/docker/docker/issues/24344#issuecomment-239942428

  • 1
    that did it! I also had to remove the invalid entries from the list leaving only Google's DNS in resolve.conf! many thanks! – ant-fx Nov 30 '16 at 9:36
  • 1
    @user1167223 Added an edit upon further testing. – Spencer K Nov 30 '16 at 14:42
  • 1
    Yup, just noticed the same thing, after restart the DNS went back, using the --dns flag is def the way to go I think. Many thanks again – ant-fx Nov 30 '16 at 15:14
  • 1
    Thanks so much! Using --dns 8.8.8.8 took the friendlyhello example from here from 2.5 MINUTES to 0.1 seconds. – Tyler Collier Apr 19 '17 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.