sudo gem install docker-sync
docker-sync.yml
version: "2"
syncs:
container-a-volume:
notify_terminal: true
src: './../path-to-volume-on-host'
sync_excludes: ['.git', '.idea', 'node_modules']
sync_userid: '0' # This is important for permission reasons, 0 is root id, becuase docker-sync uses root for creating volumes. More on this https://github.com/EugenMayer/docker-sync/issues/33
container-b-volume: # mysql etc
notify_terminal: true
src: './database/shared-data'
sync_excludes: ['.git', '.idea', 'node_modules']
sync_userid: '999' # mysql user id, edit accordingly
docker-compose-dev.yml
version: "3"
services:
mysql:
volumes:
- container-b-volume:/var/lib/mysql:nocopy
php:
volumes:
- container-a-volume:/var/www:nocopy
volumes:
container-a-volume:
external: true
container-b-volume:
external: true
docker-sync start
This will create two containers for the volumes and start syncing the files. May take sometime on the first run, afterwards it takes a moment.
docker-sync stop
docker-compose down && docker-sync clean && docker-sync start
ref post https://dev.to/kovah/cut-your-docker-for-mac-response-times-in-half-with-docker-sync-1e8j