我在docker-compose.yml中有以下服务
wildfly:
build:
dockerfile: Dockerfile.wildfly
context: .
volumes_from:
- logvolume
depends_on:
- logvolume
- mariadb-wildfly
mariadb-wildfly:
extends:
file: common-services.yml
service: mariadb-common
# ports:
# - "3307:3307"
# ------------------------------------------------------------------------
firefly:
build:
dockerfile: Dockerfile.wildfly
context: .
volumes_from:
- logvolume
depends_on:
- logvolume
- mariadb-firefly
mariadb-firefly:
extends:
file: common-services.yml
service: mariadb-common未来将会有更多类似的服务。每一个都由野蝇和一个对应的maria-db组成。不幸的是,我不能使用像这样的东西:
wildfly-moskito:
extends:
file: common-services.yml
service: wildfly-common因为使用volumes_from或depends_on的服务不允许使用extend。有没有人知道如何解决这个“复制和粘贴”-问题更优雅。
发布于 2017-11-10 17:17:28
正如@yamenk所提到的,docker-compose将符合要求。尤其是如果您只是想要基于同一图像的不同服务名称。
但是,如果你想要更复杂/更动态的东西,你可以使用像Jinja这样的工具来生成组合模板。
不幸的是,我找不到任何例子。
https://stackoverflow.com/questions/47205484
复制相似问题