I am deploying multiple stacks on a Docker swarm with docker compose.
Right now I have defined a network in my proxy stack compose file:
networks:
proxy:
driver: overlay
The other stacks reference this network the following way:
networks:
proxy_proxy:
external: true
The problem with this setup is that all other stacks now depend on the proxy stack. Removing the proxy stack (e.g in order to replace/restart it) will cause an error like this:
Failed to remove network 800w54tbh7w7clc4o8uc3y7no: Error response from daemon: rpc error: code = 9 desc = network 800w54tbh7w7clc4o8uc3y7no is in use by service 0zu489jepz586sguqrorv6j6hFailed to remove some resources from stack: proxy
Is there a way to define a network within docker compose that is not "owned" by one stack so that if it already exists any newly deployed stack will join it and if it doesn't it will be created?
That way there would be no dependency between the stacks.