gpt4 book ai didi

azure - Docker-compose,条件语句? (例如系统相关驱动程序)

转载 作者:行者123 更新时间:2023-12-02 06:12:12 24 4
gpt4 key购买 nike

这与 Docker-compose, conditional statements? (e.g. add volume only if condition) 相关问题,但我更喜欢问一个新问题,因为我的问题有点不同:
我有一个包含多个服务和多个存储的 docker-compose.yml。
我会将其部署在本地或 Azure ACI 上。
我只想有一个 docker-compose.yml ,但 Azure ACI 需要指定存储驱动程序:

  mysql-data:
driver: azure_file
driver_opts:
share_name: mysql
storage_account_name: mystore

显然本地不存在该驱动程序。
为驱动程序使用变量,例如:

  mysql-data:
driver: ${STORAGE_DRIVER}
driver_opts:
share_name: mysql
storage_account_name: mystore

由于本地overlay2驱动程序没有share_name或storage_account_name属性而出现错误。

如何解决我的问题并仅保留一个 docker-compose.yml 多容器部署?
谢谢。

最佳答案

过了一段时间,我发现 docker compose 中的条件语句有解决方案......唯一的解决方法是使用一些 sed/awk 修改

关于azure - Docker-compose,条件语句? (例如系统相关驱动程序),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75343864/

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