How to properly setup docker-sync to exclude folders

I am trying to setup docker-sync to exclude my app/cache and app/logs folder but it is not working.

Things I've tried:

Using sync_excludes: ['.idea', 'app/cache/', 'app/logs/'] but it will be translated to something like this

 command  unison -ignore='Name .idea' -ignore='Name app/cache/*' 
 -ignore='Name app/logs/*'

So then I tried using sync_args and set like this:

  - "-debug verbose"
  - "-ignore='Path app/cache'"
  - "-ignore='Path app/logs'"

command  unison -ignore='Name .idea' -ignore='Name systems' \
-debug verbose -ignore='Path app/cache/*' -ignore='Path app/logs/*'

looking at the logs I can see this

[unox][DEBUG]: recvCmd: DIR
[unox][DEBUG]: sendCmd: OK
[fswatch+] >> OK
[pred] immutable 'app/cache' = false
[pred] ignore 'app/cache/prod' = true
[pred] ignorenot 'app/cache/prod' = false
[ignore] buildUpdateChildren: ignoring path app/cache/prod

But this still seeing the events being triggered and it is still syncing to my host machine.

[pred] ignore 'app/cache/prod/annotations/5702f47f407ddb07532bfd60d8ea2919489ef4bc#__construct.cache.php' = false
[pred] ignore 'app/cache/prod/annotations/f21b469a2214195ff16e2af43f249bdbfa245c25#findPublishedOr404.cache.php' = false

Anyone know what I am missing?

my last version look like this:

version: "2"

  # optional, activate this if you need to debug something, default is false
  # IMPORTANT: do not run stable with this, it creates a memory leak, turn off verbose when you are done testing
  verbose: true

  #IMPORTANT: ensure this name is unique
    notify_terminal: true

    # which folder to watch / sync from - you can use tilde (~), it will get expanded. Be aware that the trailing slash makes a difference
    # if you add them, only the inner parts of the folder gets synced, otherwise the parent folder will be synced as top-level folder
    src: './'

    # the files should be own by root in the target cointainer
    sync_userid: 1000
    sync_strategy: 'unison'

    # optional, a list of regular expressions to exclude from the fswatch - see fswatch docs for details
    watch_excludes: ['\.git', '\.gitignore', '.*\.md']

      - "-debug verbose" #force Unison to choose the file with the later (earlier) modtime
      - "-ignore='Path app/cache'"
      - "-ignore='Path app/logs'"
      - "-ignore='Path .git'"
      - "-ignore='Path .git'"
      - "-ignore='Path vendor'"
      - "-ignore='Path upgrades'"
      - "-ignore='Path systems'"

    # optional: use this to switch to fswatch verbose mode
    watch_args: '-v'

My Env: {11:41}~ ➭ docker -v Docker version 17.09.0-ce, build afdb6d4

{11:42}~ ➭ docker-sync -v 0.4.6

SO: OSx 10.11.6

Running my projects on a mounted Filesystem Case-Sensitive created using /dev/disk2s2 on /Users/neisantos/src (hfs, local, nodev, nosuid, journaled, noowners, nobrowse)


Don't know if it's too late.

I have almost the same setup:

  • OSx 10.12.6
  • Docker version 18.06.0-ce, build 0ffa825
  • docker-sync v 0.5.7

My project structure looks like this


My docker-sync.yml looks like this

version: "2"

  verbose: true
  my-appcode-sync: # tip: add -sync and you keep consistent names as a convention
    src: '.'
    # sync_strategy: 'native_osx' # not needed, this is the default now
    sync_excludes: ['docker/var', 'changes', '.git', '.idea']

I took this from

Note the src: '.'. Initially I used src: './' like you did and ignoring folders didn't work either. After removing the / it worked for me.

Posted on by Karl Regensburger