docker on OSX slow volumes

2019-03-17 06:36发布

I'm trying to use docker beta on OSX, mainly for Symfony development but the mounted volumes are incredible slow. Even for a vanilla Symfony project I get 6s page load time. That's unbearable! Has anyone found a solution to this issue? Trying to move away from vagrant but I just can't find any reasonable way to work with docker instead.

标签: docker
10条回答
Emotional °昔
2楼-- · 2019-03-17 06:53

For people reading this now, maybe it's better to wait for Docker to fix this issue. A pull request has already been accepted to improve performance(https://github.com/docker/docker/pull/31047). This will be release somewhere in April 2017 and should be a big improvement.

I've tried some workarounds for Docker for Mac, but all of them had some pretty big disadvantages, mostly in usability. A good source for alternatives of the OSXFS can be found at: https://github.com/EugenMayer/docker-sync/wiki/Alternatives-to-docker-sync. Credits for Eugen Mayer for setting this up.

EDIT: First improvement is implemented in the edge release. https://github.com/docker/for-mac/issues/77 has more info on this.

查看更多
家丑人穷心不美
3楼-- · 2019-03-17 06:53

I've found that creating a CoreOS VM under Parallels, then using the Docker that is inside CoreOS is far faster than Docker for Mac (currently running Version 17.12.0-ce-mac49 (21995)).

I'm doing Linux code builds using CMAKE/Ninja/GCC and it's almost twice as fast as the exact same build from Docker for Mac.

In my case, I have a ton of library sources that are part of the container (e.g. Boost, OpenSSL), and a decent amount of C++ code that I keep local to my Mac.

This seems to be a recent development. Docker/Mac has become much slower than I remember it being a month or two ago. Maybe it's just me...

查看更多
乱世女痞
4楼-- · 2019-03-17 06:56

Normaly volumes should be fast. But you can not change anything to make them faster if you dont want to change the format of your disk.

But maybe the bottleneck is the CPU or RAM. You can check that with the command docker stats. These are by default set to 2 cores and 2 GB RAM. You can change this in the Docker for Mac GUI.

查看更多
来,给爷笑一个
6楼-- · 2019-03-17 07:01

We overcame this issue by synchronizing the local and the docker for mac filesystem using syncthing. We built an open source tool that follows this approach, in case it helps: https://github.com/okteto/cnd

查看更多
爷的心禁止访问
7楼-- · 2019-03-17 07:11

I spent a lot of my time in searching viable solution. And I found. d4m-nfs allow you use docker volumes via nfs. In my case it gave increase performance 16 times! (1.8sec vs ~30sec)

Also d4m-nfs has quite a intricate manual, so here is another link with detailed example: https://github.com/laradock/laradock/issues/353#issuecomment-262897619

I just leave this here for other googlers.

查看更多
登录 后发表回答