Docker Community Forums

Share and learn in the Docker community.

Speeding docker up with docker-sync

Hello,

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”
syncs:
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”
services:
app-simplest:
image: alpine
command: [‘watch’, ‘-n3’, ‘cat /var/www/index.html’]

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

version: “2”
services:
app-simplest:
volumes:
- /path/to/local/Sourcefiles/on/Mac:/path/to/files/on/docker/env
volumes:
simplest-sync:
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!