I would like to start Keycloak and it's Postgres db when I start my Spring app but it doesn't have any JDBC connection (neither dependency added in pom.xml) but still tries to create a connection with Keycloak's Postgres instance which shouldn't be done automatically.
I read the docs but the only info was about org.springframework.boot.ignore: true which disables totally the startup of the container.
In conclusion, how to start some containers and not binding them to the spring context (within any ConnectionDetails or RunningService) even if they looks familiar for known implementations of ConnectionDetails ? Maybe we should add a new label in order to make a difference between services which should be attached to Spring vs services which are additional for that Spring app but should also be started by docker-compose plugin.
Comment From: wilkinsona
I read the docs but the only info was about
org.springframework.boot.ignore: truewhich disables totally the startup of the container.
That's not what the docs describe:
If you have a container image defined in your compose.yml that you don’t want connected to your application you can use a label to ignore it. Any container with labeled with org.springframework.boot.ignore will be ignored by Spring Boot.
Looking at the code, the implementation should match the docs.
Have you tried using the ignore label? If it doesn't work for you, can you please provide a minimal sample that reproduces the problem?
Comment From: lombocska
Hi there,
spring-boot-docker-compose didn't skip my pgadmin image, but pull it, create the container and start it actually. I think there can be an issue.
Example: - pom.xml with the exxtra spring-boot-docker-compose dependency - config file - compose file
Logs
.....
Thanks for your answer in advance!
Moni
Comment From: scottfrederick
@lombocska The org.springframework.boot.ignore: true label does not control whether an image is pulled and a container is started. Spring Boot doesn't have that level of control over what Docker Compose does when it's given a compose file. The label only tells Spring Boot not to attempt to create a service connection for that container.
If you need to conditionally create containers from a compose file, you can use Docker Compose profiles and select which profiles are activated when Spring Boot starts Compose.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.