Docker-compose, conditional statements? (e.g. add volume only if condition)

后端 未结 6 1787
野趣味
野趣味 2021-02-12 02:25

I want to add a volume to my service, but only if the final user gave a folder for it. Otherwise, no volume should be mounted, for the already-prepared image has valid data in a

6条回答
  •  天命终不由人
    2021-02-12 03:17

    If you are using Rancher for orchestration, there are escapes {{...}} available you can use for conditional statements in Rancher's version of docker-compose.

    Read more about the integrated GO templating system here.

提交回复
热议问题