I have a specific configuration of containers, volumes, and networks that I have in a docker-compose file. I need to be able to create multiple instantiations of this configuration, to run side-by-side, maintaining the ability to shut one down, or bring a new one up as I please. The best method I’ve come up with so far is to use bash scripts to generate new docker-compose files, and simply add a prefix to all container names, network names, etc. in order to differentiate. The constant generation of new compose files to bring an instance up or to take one down is becoming a nightmare for me. Is there a better way to accomplish this?
I’m using Docker version 18.05.0-ce, and Docker-compose version 1.20.0 on Debian 4.9.110-1. Thanks.
I dont know about your setup.
But maybe run in swarm mode, and use:
docker stack deploy -c compose-file.yml app1
docker stack deploy -c compose-file.yml app2
(now there is 2x your setup with prefix app1 and app2)
then you can kill one with:
docker stack rm app1
It looks like this is out of the question for me. Each of these instantiations has an OpenVPN container to act as a doorway in. I attach that container to a ‘macvlan’ network with a local static IP I’m port forwarding to. Swarm apparently breaks my ability to do this. Back to dirty bash scripts.