如何在Docker Compose V2中扩展服务? [英] How to extend service in Docker Compose V2?

查看:119
本文介绍了如何在Docker Compose V2中扩展服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个不同的项目,ProjectA取决于ProjectB,而ProjectB又取决于ProjectC.

I have three different projects, ProjectA depends on ProjectB, which in turn depends on ProjectC.

假设您只想开发ProjectC,所以我只想在运行时使用一个容器的安装程序.

Assume you want to develop only ProjectC, so I want to use a setup with one container only at its runtime.

ProjectB需要ProjectC,所以我必须定义一个包含两个图像的docker-compose.

ProjectB needs ProjectC, so I have to define a docker-compose with two images.

ProjectA然后又需要ProjectB和ProjectC,所以我担心我必须在每个docker-compose.yml文件中重复很多,因为依赖链越长.

ProjectA then again needs both ProjectB and ProjectC, so I fear I have to either duplicate a lot in the each docker-compose.yml file the longer the dependency chain gets.

我知道我可以在docker-compose.yml中链接外部映像,但这意味着更多的手动设置,因为我必须检出每个项目并在每个项目中运行docker-compose.yml.

I know I can link external images in a docker-compose.yml, yet this means more manual setup, as I have to checkout each project and run docker-compose.yml in each of them.

基本上,我想知道如何管理微服务架构的docker-compose设置.

Basically I wonder how I can manage a docker-compose setup for a microservice architecture.

由于缺少更好的用语:我可以扩展docker-compose.yml文件吗?

For the lack of a better phrase: Can I extend docker-compose.yml files?

推荐答案

下一个版本(1.5.0)将支持一种扩展合成的方法(请参见

The next release (1.5.0) will support a way to extend a composition (see https://github.com/docker/compose/pull/2051). It is in master now if you want to try it out.

我认为您所描述的内容与该提案非常接近 https://github.com/docker/compose/issues/318

I think what you're describing is pretty close to this proposal https://github.com/docker/compose/issues/318

这篇关于如何在Docker Compose V2中扩展服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆