如何正确设置 docker-sync 以排除文件夹

nei*_*tos 5 unison docker

我正在尝试设置 docker-sync 以排除我的应用程序/缓存和应用程序/日志文件夹,但它不起作用。

\n\n

我尝试过的事情:

\n\n

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

\n\n
 command  unison -ignore=\'Name .idea\' -ignore=\'Name app/cache/*\' \n -ignore=\'Name app/logs/*\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

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

\n\n
sync_args:\n  - "-debug verbose"\n  - "-ignore=\'Path app/cache\'"\n  - "-ignore=\'Path app/logs\'"\n\ncommand  unison -ignore=\'Name .idea\' -ignore=\'Name systems\' \\\n-debug verbose -ignore=\'Path app/cache/*\' -ignore=\'Path app/logs/*\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

查看日志我可以看到这个

\n\n
[unox][DEBUG]: recvCmd: DIR\n[unox][DEBUG]: sendCmd: OK\n[fswatch+] >> OK\n[pred] immutable \'app/cache\' = false\n[pred] ignore \'app/cache/prod\' = true\n[pred] ignorenot \'app/cache/prod\' = false\n[ignore] buildUpdateChildren: ignoring path app/cache/prod\n
Run Code Online (Sandbox Code Playgroud)\n\n

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

\n\n
[pred] ignore \'app/cache/prod/annotations/5702f47f407ddb07532bfd60d8ea2919489ef4bc#__construct.cache.php\' = false\n[pred] ignore \'app/cache/prod/annotations/f21b469a2214195ff16e2af43f249bdbfa245c25#findPublishedOr404.cache.php\' = false\n
Run Code Online (Sandbox Code Playgroud)\n\n

有人知道我缺少什么吗?

\n\n

我的最后一个版本如下所示:

\n\n
version: "2"\n\noptions:\n  # optional, activate this if you need to debug something, default is false\n  # IMPORTANT: do not run stable with this, it creates a memory leak, turn off verbose when you are done testing\n  verbose: true\n\nsyncs:\n  #IMPORTANT: ensure this name is unique\n  dt-akeneo-unison-sync:\n    notify_terminal: true\n\n    # which folder to watch / sync from - you can use tilde (~), it will get expanded. Be aware that the trailing slash makes a difference\n    # if you add them, only the inner parts of the folder gets synced, otherwise the parent folder will be synced as top-level folder\n    src: \'./\'\n\n    # the files should be own by root in the target cointainer\n    sync_userid: 1000\n    sync_strategy: \'unison\'\n\n    # optional, a list of regular expressions to exclude from the fswatch - see fswatch docs for details\n    watch_excludes: [\'\\.git\', \'\\.gitignore\', \'.*\\.md\']\n\n    sync_args:\n      - "-debug verbose" #force Unison to choose the file with the later (earlier) modtime\n      - "-ignore=\'Path app/cache\'"\n      - "-ignore=\'Path app/logs\'"\n      - "-ignore=\'Path .git\'"\n      - "-ignore=\'Path .git\'"\n      - "-ignore=\'Path vendor\'"\n      - "-ignore=\'Path upgrades\'"\n      - "-ignore=\'Path systems\'"\n\n    # optional: use this to switch to fswatch verbose mode\n    watch_args: \'-v\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

我的环境:\n{11:41}~ \xe2\x9e\xad docker -v\nDocker 版本 17.09.0-ce,构建 afdb6d4

\n\n

{11:42}~\xe2\x9e\xad docker-sync -v\n0.4.6

\n\n

所以:OSx 10.11.6

\n\n

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

\n

Kar*_*ger 5

不知道是不是太晚了。

我有几乎相同的设置:

  • 操作系统 10.12.6
  • Docker 版本 18.06.0-ce,内部版本 0ffa825
  • docker 同步 v 0.5.7

我的项目结构如下

./
    build
    changes
    docker
        etc
        var
    some-yml-files.yml
Run Code Online (Sandbox Code Playgroud)

我的 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']
Run Code Online (Sandbox Code Playgroud)

我从https://github.com/EugenMayer/docker-sync/issues/421#issuecomment-309244156获取此内容

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