docker swarm: A stack just for shared networks

独自空忆成欢 提交于 2019-12-11 04:38:06

问题


I have many docker compose files which describe multiple stacks (Application, Monitoring infra, Logging Infra, Some other application). Some of these stacks need to share a network.

Since the dependencies between the stacks (X needs Y to start fist, Y needs Z) are becoming more and more complicated I wanted to introduce one stack that contains all the networks that will be shared so that I can then deploy all stacks in any order.

  version: "3.1"

  networks:
    iotivity:
    proxy:

Unfortunately a compose file like this doesn't create the networks. It doesn't throw an error but nothing is created. Does someone know how I can achieve this?


回答1:


You could use a dummy image. Dockerfile (copied from Mailu):

# This is an idle image to dynamically replace any component if disabled.

FROM alpine

CMD sleep 1000000d

Most probably a script is still more elegant. Just pointing out the possibility.



来源:https://stackoverflow.com/questions/46178067/docker-swarm-a-stack-just-for-shared-networks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!