Docker Community Forums

Share and learn in the Docker community.

Docker-compose un-usable on Mac Beta

Same as: Docker compose is extremely slow

Unfortunately this topic was closed, so I could not post a reply.

It is suggested that changing primary DNS from router to 8.8.8.8 (Google) resolves the issue, but this is not an appropriate action for some users who run a local DNS cache or service for LAN-connected computers.

Please can we continue the discussion?

Docker 1.11.0-beta9 is currently the newest version available.

2 Likes

Can you provide a compose file we can test that shows this behaviour? Otherwise we cannot usefully investigate what is slow.

Anything written in compose is acting this way. I can boot it up later and just send you my logs…?

If I use docker-machine and the old xhyve driver then it’s fine.

In my case using 8.8.8.8 didn’t solve.

When I disconnected WiFi it would fly.

I solved it by changing the DNS Search Domains from a “local domain” to an FQDN.

2 Likes

I installed docker for mac today and also noticed that compose is very slow when connected to the internet. I ran the following tests with OSX 10.11.4 and compose 1.7.0. The compose file is the following:

version: '2'
services:
  mysql:
    image: mysql:5.5
    ports:
      - "3306:3306"

The first test I ran was with docker-machine 0.7.0 (with docker 1.11.1):

~/compose_test ❯❯❯ time docker-compose up -d
Creating network "composetest_default" with the default driver
Creating composetest_mysql_1
docker-compose up -d  0.23s user 0.05s system 44% cpu 0.627 total

Then with docker for mac beta10:

~/compose_test ❯❯❯ time docker-compose up -d
Creating network "composetest_default" with the default driver
Creating composetest_mysql_1
docker-compose up -d  0.49s user 0.12s system 0% cpu 1:12.34 total

Based on the info from the thread that OP mentioned above, I turned off my internet connection and tried again:

~/compose_test ❯❯❯ time docker-compose up -d                                                                                                                            ⏎
Creating network "composetest_default" with the default driver
Creating composetest_mysql_1
docker-compose up -d  0.22s user 0.05s system 36% cpu 0.766 total

Something seems to be slowing down docker for mac when there’s an internet connection.

the problem seems to be that compose tries to resolve localunixsocket.local and some dns-servers does not reply and so compose is running into several timeouts, i think. googles 8.8.8.8 dns-server does respond. see my 2 screenshots from tcpdump -A -s0 -nni en0 port 53.
here with company’s dns

here with googles dns

for me it’s not an option to switch to googles dns, because i need to access company-servers and our companys internal docker-registry …

3 Likes

here i have a dirty workaround:
start a dnsmasq-container that resolves that bad dns to 127.0.0.1 and forward all other requests to companies dns.

docker run -p 127.0.0.1:53:53/tcp -p 127.0.0.1:53:53/udp --add-host=localunixsocket.<your-search-domain>:127.0.0.1 -d --dns=<company-dns-server-ip> --cap-add=NET_ADMIN andyshinn/dnsmasq

after that you have to change your system dns to 127.0.0.1 in your mac-system-network-settings.

1 Like

A less dirty work around is to add

127.0.0.1 localunixsocket localunixsocket.local

to your /etc/hosts file. Using docker-compose is much, much faster now.

2 Likes

I have the same issues, modifying /etc/hosts does not seem to resolve the issue for me. Still looking into other solutions. How has this not been fixed yet, this seems like a P1 as it makes all of Docker unusable for development and is going to put a lot people off of using Docker for Mac at all.

Thank you! This problem has been bugging me all day. In my case I’m running dnsmasq, but I also have my search domain set to local. Once I removed this (in the Mac Network Preferences panel) all was well.