Docker Community Forums

Share and learn in the Docker community.

Speeding docker up with docker-sync


I am trying to speed up a build on Docker for Mac using docker-sync. It takes about 20 minutes to build on Ubuntu, but upwards of 2 hours on a Mac.
I just wanted to go through the workflow to see if it makes sense.

I’ve got a docker run command to start docker that looks like this :

sudo docker run --privileged --mac-address xx:xx:xx:xx:xx:xx -h=“0000000000” -ti --user root --rm -v ~/local/path/to/files/:/path/to/files/on/docker/env

In order to get docker-sync going, my docker-sync.yml looks like this:

version: “2”
simplest-sync: #tip: add -sync and you keep consistent names as a convention
src: ‘./[unique name of folder containing all source code on local Mac machine]’

my docker-compose.yml looks like this:

version: “2”
image: alpine
command: [‘watch’, ‘-n3’, ‘cat /var/www/index.html’]

my docker-compose-dev.yml looks like this :

version: “2”
- /path/to/local/Sourcefiles/on/Mac:/path/to/files/on/docker/env
external: true

I had a few questions.

  • Do I need to run

docker-sync start

and then

docker-compose -f docker-compose.yml -f docker-compose-dev.yml up -d

and then run my

sudo docker run --privileged --mac-address xx:xx:xx:xx:xx:xx -h=“0000000000” -ti --user root --rm -v ~/local/path/to/files/:/path/to/files/on/docker/env

command after the sync has started? Or should all the information in the docker run command above be put into the docker-sync yml files and then I just start the first two docker-sync commands?

Would love some clarity on this. Thanks!

Is this the docker-sync from

And what are you gaining by using it? If it is file syncing from you local environment to the container, you are already accomplishing that with the volumes tag in docker-compose-dev.yml.

Also, if you are running docker-compose up why are you using docker run? Perhaps I am not understanding all of your requirements/environment.

Ah, I see the reason for docker-sync if it is the one listed above. File syncing is slow on mac.

Still not sure why you are using docker run. It looks like that should be replaced with docker-sync start.