'How to pass docker-compose files to 'docker stack deploy' dynamically?
I can run the following to launch multiple compose files:
docker stack deploy -c docker-compose.yml -c docker-compose.test.yml
I'm using this inside a gitlab-ci pipeline:
deploy:
script:
- ssh user@$server "docker stack deploy -c docker-compose.yml -c docker-compose.test.yml appname"
Problem: I'd like to pass the docker-compose files dynamically to a gitlab-ci script:
ssh user@$server "docker stack deploy $ARRAY_OF_DOCKER_COMPOSE_FILES appname"
Question: is that possible somehow for swarm mode?
Solution 1:[1]
The only solution I could find was to create an intermediate docker-compose file as follows:
docker-compose -f docker-compose.yml -f docker-compose.test.yml config > docker-compose.stack.yml
And then deploy it with:
docker stack deploy -c docker-compose.stack.yml
Not the solution that I was looking for, but at least it works.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | membersound |
