docker swarm: A stack just for shared networks

970 Views Asked by At

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

There are 1 best solutions below

0
On

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.