4

我正在尝试设置 docker-sync 以排除我的 app/cache 和 app/logs 文件夹,但它不起作用。

我尝试过的事情:

使用 sync_excludes: ['.idea', 'app/cache/ ', 'app/logs/ '] 但它会被翻译成这样

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

然后我尝试使用 sync_args 并设置如下:

sync_args:
  - "-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/*'

看着日志我可以看到这个

[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

但这仍然看到事件被触发并且它仍在同步到我的主机。

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

有人知道我错过了什么吗?

我的最后一个版本是这样的:

version: "2"

options:
  # 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

syncs:
  #IMPORTANT: ensure this name is unique
  dt-akeneo-unison-sync:
    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']

    sync_args:
      - "-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'

我的环境:{11:41}~ ➭ docker -v Docker 版本 17.09.0-ce,构建 afdb6d4

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

所以:OSx 10.11.6

在 /Users/neisantos/src 上使用https://gist.github.com/scottsb/479bebe8b4b86bf17e2d /dev/disk2s2创建的已安装文件系统区分大小写运行我的项目(hfs、local、nodev、nosuid、journaled、noowners、nobrowse )

4

1 回答 1

5

不知道是不是太晚了。

我有几乎相同的设置:

  • OSx 10.12.6
  • Docker 版本 18.06.0-ce,构建 0ffa825
  • 码头同步 v 0.5.7

我的项目结构是这样的

./
    build
    changes
    docker
        etc
        var
    some-yml-files.yml

我的 docker-sync.yml 看起来像这样

version: "2"

options:
  verbose: true
syncs:
  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']

我从https://github.com/EugenMayer/docker-sync/issues/421#issuecomment-309244156

注意src: '.'. 最初我src: './'像你一样使用并且忽略文件夹也不起作用。删除后/它对我有用。

于 2018-07-26T21:45:36.997 回答