gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-01 13:28:33 26 4
gpt4 key购买 nike

我正在尝试设置 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

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

最佳答案

不知道是不是太晚了。

我有几乎相同的设置:

  • 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: './'像你一样,忽略文件夹也不起作用。删除 / 后它对我有用。

    关于docker - 如何正确设置 docker-sync 以排除文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47200293/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com