docker swarm:仅用于共享网络的堆栈 [英] docker swarm: A stack just for shared networks

查看:222
本文介绍了docker swarm:仅用于共享网络的堆栈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多docker compose文件,它们描述了多个堆栈(应用程序,监视下,日志记录下,其他一些应用程序)。这些堆栈中的一些需要共享一个网络。

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.

由于堆栈之间的依赖性(X需要Y才能开始,Y需要Z)变得越来越复杂,我想引入一个包含所有将共享的网络的堆栈,以便我可以按任意顺序部署所有堆栈。

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?

推荐答案

您可以使用虚拟图像。 Dockerfile(从 Mailu 复制):

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.

这篇关于docker swarm:仅用于共享网络的堆栈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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