I’m trying to run two projects alongside which both define similar services. Imagine something like:
name: foo
services:
web:
- ...
db:
- ...
and
name: bar
services:
web:
- ...
db
- ...
When trying to build a megaproject that would include both of these Compose files and run them altogether, I cannot because the services name obviously conflict. Isn’t there a way for Compose to scope all of these services within their name property?
Can you give a little more explanation about your goal? I’m not sure why you would set the project name and include both in a single file. Are you trying to run multiple compose projects from a single entry point?
Although I misunderstood the issue first (so thank you for pointing out the real issue), I’m still not sure about the use case. If I set the project name in a compose file I think of it as a separate project and I want to isolate it from the other projects. If I know I want some projects to communicate, even when I just share networks, I have to deal with it and name my services correctly or add a network alias and use that for communication instead of the service names. In this case I understand it is not about communication but the fact that the same service names cannot be used in a project, but I think it is also a situation when we have to prepare our files to work well together. Maybe there is a special use case which I didn’t think of and we should continue trying to find a solution or ask for a feature request, but it is also possible that the whole problem should be approached differently.