Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple compose configs #206

Closed
clangaxon opened this issue Mar 23, 2018 · 7 comments
Closed

Support for multiple compose configs #206

clangaxon opened this issue Mar 23, 2018 · 7 comments
Assignees
Milestone

Comments

@clangaxon
Copy link

Trying to upgrade from the old 5.3 pre-fork version to 1.1.0, we're running into the inability to have multiple docker-compose resources on a single box. In the old version, we hacked around --remove-orphans with options = ['-f', 'second.yml']. In this version, options is now a string and a string with a space doesn't seem to work:

Error: Execution of '/usr/local/bin/docker-compose -f /etc/docker/first.yml -f /etc/docker/second.yml up -d --remove-orphans' returned 1: .IOError: [Errno 2] No such file or directory: u'./ /etc/docker/first.yml'

27240 execve("/usr/local/bin/docker-compose-1.9.0", ["/usr/local/bin/docker-compose", "-f", "/etc/docker/first.yml", "-f /etc/docker/second.yml", "up", "-d", "--remove-orphans"], [/* 27 vars */] <unfinished ...>

Are we missing something? :)

Thanks.

@scotty-c
Copy link
Contributor

@clangaxon because of the new version of stdlib this module uses we have to declare inputs as types ie strings, arrays etc. What is the use case to have multiple compose files on a single compute resource?

@scotty-c scotty-c self-assigned this Mar 28, 2018
@clangaxon
Copy link
Author

I had the same question, but I inherited this code. :)

The two configs are generated separately, and if each uses a separate docker-compose resource, the --remove-orphans wipes out the first one to run.

If this is a bizarre use case, we can come up with a work around, but it seemed like a useful feature.

Thanks!

@clangaxon
Copy link
Author

We worked around this by rearranging the configs into separate directories so that docker-compose would pull a different project name. Support for -P might be a better way to support this?

Thanks.

@scotty-c
Copy link
Contributor

scotty-c commented Apr 4, 2018

@clangaxon Do you have an example docker-compose command (with the -P) that I can look at?
If it makes sense to add as a feature we can look at that.

@clangaxon
Copy link
Author

I don't have an actual example since that's now how we solved it - we couldn't pass -p in 'options' because of the same string vs. array limitation. :)

In our case, we had e.g.:

/etc/docker/compose/first.yml
/etc/docker/compose/second.yml

docker-compose considered both to be in a project named 'compose' because of the directory name, and --remove-orphans wiped out the first container when the second resource executed.

It looks like -p allows explicitly setting the project name, so two resource definitions could co-exist in the same directory.

@jacobmw
Copy link

jacobmw commented Apr 30, 2018

We are trying to use two compose files in order to have the 2nd compose file be an override for the first.
https://docs.docker.com/compose/reference/overview/#use--f-to-specify-name-and-path-of-one-or-more-compose-files
Our main compose file is provided by a 3rd party which we would like to leave unmodified to make updates easier, and then use our maintained compose file for the overrides.

@MWilsonPuppet
Copy link

This issue has been resolved in #332 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants