compose: docker-compose slow on docker for mac os beta
docker-compose is slow with docker for mac os beta on my home network. Here is my workaround for now:
- docker-compose up (take ages)
- shut down wifi
- docker-compose up (really fast)
- re-enable wifi
I do not reproduce the issue on another network than mine, my work network for instance do not make it slow. I already had a potentially related issue with the docker client itself which couldn’t pull any image (going to bizarre local ips instead of the docker hub registry) but it has been fixed since one of the latest docker for mac os beta update.
The issue is not reproduced against the docker-toolbox, only the “native” docker for mac.
My version of docker-compose is : docker-compose version 1.7.0, build 0d7bf73
My version of docker for mac is: Version 1.11.1-beta10 (build: 6662)
The docker-compose file I’m trying to run is:
#docker-compose.yml
sync-engine:
build: nylas-sync-engine
ports:
- 5555:5555
links:
- mysql:mysql
- redis:redis
hostname: sync-engine
log_opt:
max-size: "10m"
max-file: "10"
mysql:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=whateverpassword
volumes:
- nylas_mysql:/var/lib/mysql
log_opt:
max-size: "10m"
max-file: "10"
redis:
image: redis
volumes:
- nylas_redis:/data
log_opt:
max-size: "10m"
max-file: "10"
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 65
- Comments: 111 (6 by maintainers)
Commits related to this issue
- Warn if Docker for Mac is likely to be slow As per [docker issue #3419](https://github.com/docker/compose/issues/3419#issuecomment-221793401), Docker for Mac uses "localunixsocket" instead of "localh... — committed to palantir/docker-compose-rule by alicederyn 7 years ago
- Warn if Docker for Mac is likely to be slow As per [docker issue #3419](https://github.com/docker/compose/issues/3419#issuecomment-221793401), Docker for Mac uses "localunixsocket" instead of "localh... — committed to palantir/docker-compose-rule by alicederyn 7 years ago
I’ve had the same issues, and found a post (sorry, lost the ref) mentioning docker-compose is trying to resolve
localunixsocket.local
. You can get insight into the dns lookup by runningsudo tcpdump -A -s0 -nni en0 port 53
For now I’ve pointed
localunixsocket.local
to localhost in my/etc/hosts
. Now everything is speedy again.enabling

Exclude simple hostnames
from proxy settings worked perfectly for me.[UPDATE]: Or set env variable
NO_PROXY
to some value.Not sure why but I had to remove any local domain element to make it work.
/etc/hosts:
127.0.0.1 localunixsocket
Hi guys,
127.0.0.1 localunixsocket
to etc/hosts solved the issue for mesuper awesome comment, @jewilmeer! For me I had to add a few more addresses to /etc/hosts which I discovered using your
tcpdump
command:After those additions – speedy! Actually, amazingly speedy, seems a good bunch faster than when using Docker Toolbox! woop woop 😃 (Though that may be a highly subjective observation!)
@smith64fx please keep your comments constructive; it’s a beta, it’s not a finished product yet, so bugs and performance issues are expected. It’s exactly these kind of issues that need reporting (and testing) to resolve them.
adding
127.0.0.1 localunixsocket
in/etc/hosts
helps. I’m usingdocker-compose version 1.18.0, build 8dd22a9
Confirmed that
127.0.0.1 localunixsocket
in/etc/hosts
dramatically speeds things up, please fix!Hi all, after the upgrade to docker for mac
Version 1.12.1 (build: 12133)
i had to add the127.0.0.1 localunixsocket
again in the/etc/hosts
I’m actually more curious as to why this started happening in the first place. It seems a bit silly to me for me to have to modify my hosts file as a workaround to a problem that was recently introduced and have it declared to be the “solution”.
Same bug here. I have to add in the three lines to /etc/hosts to solve this problem. 127.0.0.1 localunixsocket 127.0.0.1 localunixsocket.lan 127.0.0.1 localunixsocket.local
@Erwyn I’ve experienced the same issue with Vodafone Easybox as well… it turned out that Vodafone Easybox binds the search of
.local
domains to the router (to evaluate the dynamic hostname of your router, namelyeasy.box
) and my guess is that this binding was causing thedocker-compose
to wait for the response of the router (I might be completely wrong on this)… but adding127.0.0.1 localunixsocket.local
toetc/hosts
solved the issue for meDunno if this helps but I used to have this issue and I fixed it by changing my DNS servers to
8.8.8.8
and8.8.4.4
.Also this issue only happened on my Home network. At work I did not have this issue.
Same bug. This worked for me.
$ sudo vim /etc/hosts
Any word on a real solution to this other than having to tell everyone to add a host rule or turn off proxies?
@davidino solution of putting
127.0.0.1 localunixsocket
in your/etc/hosts
resolved the issue for me.@KryDos A new release should be coming out this week with some speed improvements
No estimative on solving this very annoying bug?
Of course you find your own solution right after you post the question. It looks like an installed package in our dev environment updated DNS settings in OSX which cause the problem. Once I reset the OSX DNS to use the defaults in /etc/resolv.conf, everything works.
ping @frenchben 😄
+1
I also suddenly started having this issue. Just like @timsuchanek I have been using docker-compose for about a year now and
docker-compose up
hangs almost indefinitely. Like everyone else, when I switch off wifi it works.I am on
docker-compose version 1.9.0, build 2585387
Edit: Adding
127.0.0.1 localunixsocket
to/etc/hosts
fixed it for now. I am on macOS 10.11.6For me, removing the
.local
search domain made all the difference.I just had to also add
127.0.0.1 localunixsocket.lan
to make it work. I’m using macOS Sierra.@stijn Yes, when i turn off wifi everything works like charm
Von meinem iPhone gesendet
Which hosts file to modify ?
Are the changes to /etc/host to the host machine or the docker container??
@davidino Thx Bro, works perfectly! I’m interested why we need this workaround?
I have a very similar issue, but I think it may be related to my use of DNSCrypt?
I switched back using virtualbox with docker-machine. Problem doesn’t exist and it’s up to 10x faster than Docker Mac Beta!
Here is the backtrace that causes the spurious DNS lookup:
Still a problem on the latest version. The above fixes don’t seem to do anything for me, at some point it just gets so slow that it hangs. The workaround for me is to restart Docker for mac every so often.
I added
127.0.0.1 localunixsocket
in/etc/hosts
and it worked for me, thanks ! (but it is still a wtf bug)What fixed it for me was going to my System Preferences / Network / Advanced / DNS / Search Domains, and removing the entry “.local.” which I had put there. This caused the macOS to populate the Search Domains only with the default value, “localdomain”. And then
docker-compose
became responsive again.docker
itself was responsive all the time.I don’t know, but I would guess that perhaps
docker
is correctly finding an on-system resource using an IP address or a stable local name, whiledocker-compose
is unsafely relying onlocaldomain
always being defined as one of the search domains. But I dunno!+1
+1
MacOS Sierra, 10.12.5. Docker Community Edition Version 17.06.0-ce-mac18 (18433) Channel: stable d9b66511e0
I already had DNS as 8.8.8.8. Needed to add both localunixsocket.local and localunixsocket into /etc/hosts. The instant this was added my running docker-compose sprang to life.
I have the same error. Adding localunixsocket to
/etc/hosts
. did not work. Temporary fix marking theExclude simple hostnames
in proxies tab.@shin- in the
1.9.0-rc4
I still have the issue. I don’t know, what I did, but some days ago I didn’t have the issue, usingdocker-compose
for over a year.docker-compose --version
is really fastdocker-compose ps
is very slow Disabling Wifi -ps
is fast, too@gsong unfortunately that didn’t help for me
Also running into this issue, the changes to hosts makes a little bit of a difference, but still a bit sluggish.
127.0.0.1 localunixsocket.local 127.0.0.1 localunixsocket
Is it just me, or does doing a DNS lookup for
localunixsocket
seem counterintuitive? That seems like a filler hostname that’s just used as a placeholder when something is expecting TCP-style addresses instead of local domain sockets.At any rate, the difference in times between the local DNS and Google’s DNS is interesting… I’d be curious what’s causing it to do that. (sadly, I think you’d have to have another TCP dump on the DNS server pointed to by the router in order to tell, unless there’s a
tracert
equivalent for DNS lookups that can preserve intermediate servers hit by a recursive query)This might be informative as well (found in
man nslookup
on Mac OS X):Since they don’t really give any clarification on what specific mechanism
nslookup
does use vs. what Mac OS X provides, it’s difficult to say whether Docker would be expected to share the behavior ofnslookup
, or that of other Mac OS X apps… (my guess would be that it uses the same methodsnslookup
does, but we’d probably have to dig into the code for both to figure that out definitively)Hi, Is there any news about this?
I have same issue. Compose/Docker/OSX versions are same as @eugenesia has. I use WiFi at home and at office and at my home it works incredibly slow. At office it works as expected (fast).
I thought maybe it is something related to DNS server of my ISP (home and office internet providers are different) and I tried to use some public DNS including Google’s one but it didn’t help.
If I turn WiFi off then
docker-compose
works really fastgot the same issue 😄
+1