问题
I'm using docker for mac and curl command from docker container takes way longer than from my mac. Container is using default bridge network.
See below curl command from inside the container:
Command from mac:
Thanks.
回答1:
It is a known issue that networking with bridge / nat mode in docker is slow. You could use hosted mode. This should be solved by the macvlan driver.
For further reference, please look at this bug.
回答2:
This is known and solved in different ways, please see those benchmarks here: https://github.com/EugenMayer/docker-sync/wiki/4.-Performance You also see, that the new :cached mount will not help with application performance, but can be used with docker-sync to speedup sync. :delegated will help with application performance but will still take a while to land in d4m.
You can try using http://docker-sync.io with the native_osx strategy - it results in a speedup from 60-100 times faster, depending on your hardware performance and project size ( closer to 100 with bigger projects /and or worse hardware).
I am biased, so you want to look at the alternatives here https://github.com/EugenMayer/docker-sync/wiki/Alternatives-to-docker-sync - a detailed write up in what the difference is in strategies, you can look up here https://github.com/EugenMayer/docker-sync/wiki/8.-Strategies
回答3:
One option is to switch to Docker machine. Docker machine doesn't have the problem like docker for mac.
来源:https://stackoverflow.com/questions/41656215/slowness-in-docker-container