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

Clarify the directory that's used by default to find Docker Compose compose.yaml #40512

Closed
sivaprasadreddy opened this issue Apr 25, 2024 · 2 comments
Assignees
Labels
type: documentation A documentation update
Milestone

Comments

@sivaprasadreddy
Copy link

I have a repository which contains multiple Spring Boot applications and I would like to use compose.yml files for local development.

project_root:
   - catalog
       - src
       - pom.xml
       - compose.yml
   - orders
       - src
       - pom.xml
       - compose.yml 

I have added org.springframework.boot:spring-boot-docker-compose dependency in each application. When I start the CatalogApplication/OrdersApplication from IntelliJ IDEA, it expects the compose.yml file to be in project_root not inside catalog or orders directory.

But if I run mvn spring-boot:run from catalog directory it is loading catalog/compose.yml file as expected.

Expected Behaviour:
When running any Spring Boot application, from IDE or terminal, the compose.yml should be loaded from the current spring boot application root directory.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 25, 2024
@sivaprasadreddy
Copy link
Author

When I enable compose support for testing with spring.docker.compose.skip.in-tests=false then surprisingly the tests are expecting the compose.yml file inside module directory.

Upon further investigation, when I check the Run Configuration of CatalogApplication in Intellij IDEA, the Working Directory is by default set to the project root directory. When I change it to $MODULE_WORKING_DIR$ then it is loading the compose.yml file from the module directory only as expected.

@wilkinsona
Copy link
Member

when I check the Run Configuration of CatalogApplication in Intellij IDEA, the Working Directory is by default set to the project root directory

Spring Boot uses this working directory to find the file. If the IDE is setting it incorrectly then, unfortunately, there's nothing that we can do about that at runtime. However, I think we can clarify the documentation. It currently states that Spring Boot will "search for a compose.yml and other common compose filenames in your application directory". We should say "working directory" here rather than "application directory".

@wilkinsona wilkinsona changed the title Spring Boot Docker Compose support loading compose.yml from project root than current application root directory Clarify the directory that's used by default to find Docker Compose compose.yaml Apr 25, 2024
@wilkinsona wilkinsona added type: documentation A documentation update and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 25, 2024
@wilkinsona wilkinsona added this to the 3.1.x milestone Apr 25, 2024
@mhalbritter mhalbritter self-assigned this Apr 25, 2024
@mhalbritter mhalbritter modified the milestones: 3.1.x, 3.1.12 Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation A documentation update
Projects
None yet
Development

No branches or pull requests

4 participants