【问题标题】:docker - multiple projects on one Dockerfile and docker-compose.ymldocker - 一个 Dockerfile 和 docker-compose.yml 上的多个项目
【发布时间】:2017-06-11 00:45:40
【问题描述】:

我从 Docker 开始,我认为这很棒!现在我正在为这个组织寻找解决方案:
现在我有了这个结构:

Applications
| +--app1
| |  +--node_modules   
| |  +--package.json  
| |  +--...  
| +--app2  
| |  +--node_modules
| |  +--package.json  
| |  +--...  
| ....   
| docker-compose.app1.yml
| docker-compose.app2.yml
| ....
| Dockerfile  //my personalized image for all projects

但我想达到这个:

Applications
| +--app1  
| |  +--node_modules //empty in host  
| |  +--package.json  
| |  +--docker-compose.app1.yml  //override compose
| |  +--...  
| +--app2  
| |  +--node_modules  //empty in host  
| |  +--package.json  
| |  +--...  
| ....  
| +--node_modules //global node_modules folder (linked to projects)  
| docker-compose.yml //principal compose  
| Dockerfile  //my personalized image for all projects

我也在考虑创建一个全局“服务器”并链接 VHosts 上的所有项目,但我将如何访问每个项目?

【问题讨论】:

  • 你能再具体一点吗? “获取访问权限”是什么意思?

标签: nginx docker docker-compose dockerfile


【解决方案1】:

您正在寻找 docker-comopose 扩展。这允许您覆盖以前的配置。

web: 
    extends: file: common-services.yml
    service: webapp

查看完整文档:https://docs.docker.com/compose/extends/#extending-services

【讨论】:

    猜你喜欢
    • 2015-02-09
    • 2017-03-12
    • 1970-01-01
    • 1970-01-01
    • 2018-05-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-26
    相关资源
    最近更新 更多