【问题标题】:How to exclude some paths when mounting the volume?安装卷时如何排除某些路径?
【发布时间】:2015-11-10 06:35:16
【问题描述】:

我想在当前目录中挂载所有内容,/node_modules/client/bower_components 除外。我目前必须手动安装所有路径,如下所示:

app:
  build: .
  ports:
    - "3000:3000"
    - "35729:35729"
  links:
    - mongo
  volumes:
    - client/app:/www/app/client/app
    - client/assets:/www/app/client/assets
    - client/components:/www/app/client/components
    - server:/www/app/server
    ...
mongo:
  image: mongo
  ports:
    - "27017:27017"

我是否可以通过某种方式排除某些路径,例如!client/bower_components!node_modules

【问题讨论】:

标签: docker docker-compose


【解决方案1】:

是的,你可以。

这个问题herehere都有答案。

为了快速参考,解决方案如下。

volumes:
  - ./parent:/usr/share/elasticsearch/parent
  - /usr/share/elasticsearch/parent/node_modules/

这里是docker volume docs

【讨论】:

    猜你喜欢
    • 2015-03-17
    • 1970-01-01
    • 2013-08-30
    • 2022-11-07
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 2015-12-29
    • 1970-01-01
    相关资源
    最近更新 更多