问题
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