我正在尝试设置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
SO:OSx 10.11.6
在使用https://gist.github.com/scottsb/479bebe8b4b86bf17e2d创建的已挂载文件系统区分大小写上运行项目 / users / neisantos / src上的/ dev / disk2s2(hfs,local,nodev,nosuid,journaled,noowners,nobrowse)
答案 0 :(得分:2)
不知道是否为时已晚。
我的设置几乎相同:
我的项目结构如下
./
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: './'
,而忽略文件夹也不起作用。删除/
后,它对我有用。