My docker compose files in different projects are interfering

I have 2 projects (called app-api and chat-api) and I'd like to use docker-compose configuration in each.

Both projects have such structure:

root
|_ .idea
|_ deployment
   |_ database.Dockerfile
   |_ web.Dockerfile
  |_ api.Dockerfile
  |_ docker-compose.yml
|_ rest of project's code...

If I create new docker-compose configuration in 1st project, give it docker-compose.yml and set project name via env. variable (COMPOSE_PROJECT_NAME=app-api) I can run it. It will compose Docker images and I can see them in Services tab.

But if I then go to 2nd project and create similar configuration (but pointing to docker-compose.yml in 2nd project) I'll get an error:

Deploying 'Compose: deployment'...
Failed to deploy 'Compose: deployment': Can't read compose file at [...]\app\deployment\docker-compose.yml

Plugin incorrectly takes docker-compose.yml from 1st project instead of 2nd. It should take one in

[...]\chat-api\deployment\docker-compose.yml

Screenshot of 2nd configuration:

If I use command

[...]\chat-api>docker-compose -f deployment/docker-compose.yml -p chat-api up --build

containers are composed and started correctly therefore I think the issue is with plugin. Does anybody know how to use it correctly or work around that bug (if it is a bug...)?

5

I have a very similar problem. When using the docker compose command in project A, it works file. Then I bring that down and go to project B to bring its docker compose up. It works, BUT it uses the docker compose file from project A incorrectly.

0

Same here, project B tries to run the compose file of project A. I've tried closing the individual projects, recreating the link to the docker-compose file. None of it works, it keeps pointing to the wrong project path. It renders the functionality fairly useless. Is their a workaround? Will it be fixed?

0

I have the exact same problem. Not only that, it's also not possible (for me) to have the two docker-compose configuration launched and active at same time for the two projects simultaneously.
I really hope it gets solved quickly. I got faith in jetbrains

0

I am facing the exact same issue. A lot happens in a year - Did anyone find any workaround or fix for this issue. One workaround is to make sure that the docker context directories are named differently - but I do not want to do that.

0

The Docker run config uses the compose file from the 'other' project. When I open the file locator the path is correct, but when I run it the file from the other project is used. 'docker-compose up' in terminal works as expected.

0

Indeed this issue still persist using PHPStorm version 2021.3.3, this must be fixed !

0

The issue is also present in IntelliJ IDEA 2021.3.3 (Ultimate Edition). Super annoying.

0

Still happening in IDEA 2023.3 (Ultimate Edition). 

0

请先登录再写评论。